gnu.io

## Class SerialPort

- java.lang.Object
- - gnu.io.CommPort
  - - gnu.io.SerialPort

Direct Known Subclasses:
  RXTXPort

    public abstract class SerialPort
    extends CommPort

Since:
  JDK1.0

### Field Summary

Fields
`static int` `DATABITS_5`
`static int` `DATABITS_6`
`static int` `DATABITS_7`
`static int` `DATABITS_8`
`static int` `FLOWCONTROL_NONE`
`static int` `FLOWCONTROL_RTSCTS_IN`
`static int` `FLOWCONTROL_RTSCTS_OUT`
`static int` `FLOWCONTROL_XONXOFF_IN`
`static int` `FLOWCONTROL_XONXOFF_OUT`
`static int` `PARITY_EVEN`
`static int` `PARITY_MARK`
`static int` `PARITY_NONE`
`static int` `PARITY_ODD`
`static int` `PARITY_SPACE`
`static int` `STOPBITS_1`
`static int` `STOPBITS_1_5`
`static int` `STOPBITS_2`

### Fields inherited from class gnu.io.CommPort

`name`

### Constructor Summary

Constructors
Constructor and Description
`SerialPort()`

### Method Summary

Methods
`abstract void` `addEventListener(SerialPortEventListener lsnr)`
`abstract int` `getBaudBase()`
`abstract int` `getBaudRate()`
`abstract boolean` `getCallOutHangup()`
`abstract int` `getDataBits()`
`abstract int` `getDivisor()`
`abstract byte` `getEndOfInputChar()`
`abstract int` `getFlowControlMode()`
`abstract boolean` `getLowLatency()`
`abstract int` `getParity()`
`abstract byte` `getParityErrorChar()`
`abstract int` `getStopBits()`
`abstract java.lang.String` `getUARTType()`
`abstract boolean` `isCD()`
`abstract boolean` `isCTS()`
`abstract boolean` `isDSR()`
`abstract boolean` `isDTR()`
`abstract boolean` `isRI()`
`abstract boolean` `isRTS()`
`abstract void` `notifyOnBreakInterrupt(boolean enable)`
`abstract void` `notifyOnCarrierDetect(boolean enable)`
`abstract void` `notifyOnCTS(boolean enable)`
`abstract void` `notifyOnDataAvailable(boolean enable)`
`abstract void` `notifyOnDSR(boolean enable)`
`abstract void` `notifyOnFramingError(boolean enable)`
`abstract void` `notifyOnOutputEmpty(boolean enable)`
`abstract void` `notifyOnOverrunError(boolean enable)`
`abstract void` `notifyOnParityError(boolean enable)`
`abstract void` `notifyOnRingIndicator(boolean enable)`
`abstract void` `removeEventListener()`
`abstract void` `sendBreak(int duration)`
`abstract boolean` `setBaudBase(int BaudBase)`
`abstract boolean` `setCallOutHangup(boolean NoHup)`
`abstract boolean` `setDivisor(int Divisor)`
`abstract void` `setDTR(boolean state)`
`abstract boolean` `setEndOfInputChar(byte b)`
`abstract void` `setFlowControlMode(int flowcontrol)`
`abstract boolean` `setLowLatency()`
`abstract boolean` `setParityErrorChar(byte b)`
`abstract void` `setRTS(boolean state)`
`abstract void` `setSerialPortParams(int b, int d, int s, int p)`
`abstract boolean` `setUARTType(java.lang.String type, boolean test)`

### Methods inherited from class gnu.io.CommPort

`close, disableReceiveFraming, disableReceiveThreshold, disableReceiveTimeout, enableReceiveFraming, enableReceiveThreshold, enableReceiveTimeout, getInputBufferSize, getInputStream, getName, getOutputBufferSize, getOutputStream, getReceiveFramingByte, getReceiveThreshold, getReceiveTimeout, isReceiveFramingEnabled, isReceiveThresholdEnabled, isReceiveTimeoutEnabled, setInputBufferSize, setOutputBufferSize, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### DATABITS_5

    public static final int DATABITS_5

See Also:
  Constant Field Values

#### DATABITS_6

    public static final int DATABITS_6

See Also:
  Constant Field Values

#### DATABITS_7

    public static final int DATABITS_7

See Also:
  Constant Field Values

#### DATABITS_8

    public static final int DATABITS_8

See Also:
  Constant Field Values

#### PARITY_NONE

    public static final int PARITY_NONE

See Also:
  Constant Field Values

#### PARITY_ODD

    public static final int PARITY_ODD

See Also:
  Constant Field Values

#### PARITY_EVEN

    public static final int PARITY_EVEN

See Also:
  Constant Field Values

#### PARITY_MARK

    public static final int PARITY_MARK

See Also:
  Constant Field Values

#### PARITY_SPACE

    public static final int PARITY_SPACE

See Also:
  Constant Field Values

#### STOPBITS_1

    public static final int STOPBITS_1

See Also:
  Constant Field Values

#### STOPBITS_2

    public static final int STOPBITS_2

See Also:
  Constant Field Values

#### STOPBITS_1_5

    public static final int STOPBITS_1_5

See Also:
  Constant Field Values

#### FLOWCONTROL_NONE

    public static final int FLOWCONTROL_NONE

See Also:
  Constant Field Values

#### FLOWCONTROL_RTSCTS_IN

    public static final int FLOWCONTROL_RTSCTS_IN

See Also:
  Constant Field Values

#### FLOWCONTROL_RTSCTS_OUT

    public static final int FLOWCONTROL_RTSCTS_OUT

See Also:
  Constant Field Values

#### FLOWCONTROL_XONXOFF_IN

    public static final int FLOWCONTROL_XONXOFF_IN

See Also:
  Constant Field Values

#### FLOWCONTROL_XONXOFF_OUT

    public static final int FLOWCONTROL_XONXOFF_OUT

See Also:
  Constant Field Values

### Constructor Detail

#### SerialPort

    public SerialPort()

### Method Detail

#### setSerialPortParams

    public abstract void setSerialPortParams(int b,
                           int d,
                           int s,
                           int p)
                                      throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### getBaudRate

    public abstract int getBaudRate()

#### getDataBits

    public abstract int getDataBits()

#### getStopBits

    public abstract int getStopBits()

#### getParity

    public abstract int getParity()

#### setFlowControlMode

    public abstract void setFlowControlMode(int flowcontrol)
                                     throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### getFlowControlMode

    public abstract int getFlowControlMode()

#### isDTR

    public abstract boolean isDTR()

#### setDTR

    public abstract void setDTR(boolean state)

#### setRTS

    public abstract void setRTS(boolean state)

#### isCTS

    public abstract boolean isCTS()

#### isDSR

    public abstract boolean isDSR()

#### isCD

    public abstract boolean isCD()

#### isRI

    public abstract boolean isRI()

#### isRTS

    public abstract boolean isRTS()

#### sendBreak

    public abstract void sendBreak(int duration)

#### addEventListener

    public abstract void addEventListener(SerialPortEventListener lsnr)
                                   throws java.util.TooManyListenersException

Throws:
  `java.util.TooManyListenersException`

#### removeEventListener

    public abstract void removeEventListener()

#### notifyOnDataAvailable

    public abstract void notifyOnDataAvailable(boolean enable)

#### notifyOnOutputEmpty

    public abstract void notifyOnOutputEmpty(boolean enable)

#### notifyOnCTS

    public abstract void notifyOnCTS(boolean enable)

#### notifyOnDSR

    public abstract void notifyOnDSR(boolean enable)

#### notifyOnRingIndicator

    public abstract void notifyOnRingIndicator(boolean enable)

#### notifyOnCarrierDetect

    public abstract void notifyOnCarrierDetect(boolean enable)

#### notifyOnOverrunError

    public abstract void notifyOnOverrunError(boolean enable)

#### notifyOnParityError

    public abstract void notifyOnParityError(boolean enable)

#### notifyOnFramingError

    public abstract void notifyOnFramingError(boolean enable)

#### notifyOnBreakInterrupt

    public abstract void notifyOnBreakInterrupt(boolean enable)

#### getParityErrorChar

    public abstract byte getParityErrorChar()
                                     throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### setParityErrorChar

    public abstract boolean setParityErrorChar(byte b)
                                        throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### getEndOfInputChar

    public abstract byte getEndOfInputChar()
                                    throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### setEndOfInputChar

    public abstract boolean setEndOfInputChar(byte b)
                                       throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### setUARTType

    public abstract boolean setUARTType(java.lang.String type,
                      boolean test)
                                 throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### getUARTType

    public abstract java.lang.String getUARTType()
                                          throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### setBaudBase

    public abstract boolean setBaudBase(int BaudBase)
                                 throws UnsupportedCommOperationException,
                                        java.io.IOException

Throws:
  `UnsupportedCommOperationException`
  `java.io.IOException`

#### getBaudBase

    public abstract int getBaudBase()
                             throws UnsupportedCommOperationException,
                                    java.io.IOException

Throws:
  `UnsupportedCommOperationException`
  `java.io.IOException`

#### setDivisor

    public abstract boolean setDivisor(int Divisor)
                                throws UnsupportedCommOperationException,
                                       java.io.IOException

Throws:
  `UnsupportedCommOperationException`
  `java.io.IOException`

#### getDivisor

    public abstract int getDivisor()
                            throws UnsupportedCommOperationException,
                                   java.io.IOException

Throws:
  `UnsupportedCommOperationException`
  `java.io.IOException`

#### setLowLatency

    public abstract boolean setLowLatency()
                                   throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### getLowLatency

    public abstract boolean getLowLatency()
                                   throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### setCallOutHangup

    public abstract boolean setCallOutHangup(boolean NoHup)
                                      throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`

#### getCallOutHangup

    public abstract boolean getCallOutHangup()
                                      throws UnsupportedCommOperationException

Throws:
  `UnsupportedCommOperationException`