com.moxa.mxnportapi

## Class CommonNPortDriver

- java.lang.Object
- - com.moxa.mxnportapi.CommonNPortDriver

- All Implemented Interfaces:
    MxNPort, java.util.Comparator<java.lang.Integer>
  Direct Known Subclasses:
    NPortDriver

      public abstract class CommonNPortDriver
      extends java.lang.Object
      implements MxNPort, java.util.Comparator<java.lang.Integer>

  Created by bird on 7/21/2017.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.moxa.mxnportapi.MxNPort

      `MxNPort.FlowCtrl, MxNPort.IoctlMode, MxNPort.LineError, MxNPort.ModemStatus`

  - ### Field Summary

    - ### Fields inherited from interface com.moxa.mxnportapi.MxNPort

      `CTS_FLOW_ENABLE, CTS_OFF, CTS_ON, DATA_BITS_5, DATA_BITS_6, DATA_BITS_7, DATA_BITS_8, DCD_OFF, DCD_ON, DSR_FLOW_ENABLE, DSR_OFF, DSR_ON, DTR_FLOW_ENABLE, DTR_OFF, DTR_ON, DTRDSR_FLOW_ENABLE, DTRDSR_FLOW_MASK, FLUSH_INPUT, FLUSH_OUTPUT, LINE_ERROR, LINE_NO_ERROR, PARITY_EVEN, PARITY_MARK, PARITY_NONE, PARITY_ODD, PARITY_SPACE, RI_OFF, RI_ON, RTS_FLOW_ENABLE, RTS_OFF, RTS_ON, RTSCTS_FLOW_ENABLE, RTSCTS_FLOW_MASK, STOP_BITS_1, STOP_BITS_1_5, STOP_BITS_2, XOFF_FLOW_ENABLE, XON_FLOW_ENABLE, XONXOFF_FLOW_ENABLE, XONXOFF_FLOW_MASK`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommonNPortDriver()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(java.lang.Integer o1, java.lang.Integer o2)`
    `abstract int` | `write(byte[] buffer)` Puts a block of data to the driver's output buffer.

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.moxa.mxnportapi.MxNPort

      `close, flush, getBaud, getFlowCtrl, getIoctlMode, getLineStatus, getModemStatus, getNPortIPAddress, getNPortMACAddress, getNPortMaximumPort, getNPortModelName, getNPortPortIndex, getOQueue, open, read, read, read, setBaud, setBreak, setDTR, setFlowCtrl, setIoctlMode, setRTS, write, write`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### CommonNPortDriver

          public CommonNPortDriver()

  - ### Method Detail

    - #### compare

          public int compare(java.lang.Integer o1,
                             java.lang.Integer o2)

      Specified by:
        `compare` in interface `java.util.Comparator<java.lang.Integer>`

    - #### write

          public abstract int write(byte[] buffer)
                             throws MxException

      Description copied from interface: `MxNPort`
      Puts a block of data to the driver's output buffer. The actual length of data written depends on the amount of free space in the driver's output buffer. The write() returns when all data in the buffer has been sent.
      Specified by:
        `write` in interface `MxNPort`
      Parameters:
        `buffer` - [in] The buffer contains all data to send.
      Returns:
        The actual data written to the device.
      Throws:
        `MxException` - If an error occurs.