Package com.celer

Class COMOutputStream

java.lang.Object
java.io.OutputStream
com.celer.COMOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

public class COMOutputStream
extends java.io.OutputStream
The COM output stream can be used to write to a COM port.

CelerSMS

  • Method Summary

    Modifier and Type Method Description
    void write​(byte[] buf)
    Writes buf.length bytes from the specified byte array to the COM port.
    void write​(byte[] buf, int off, int len)
    Writes len bytes from the specified byte array starting at offset off to the COM port.
    void write​(int bb)
    Writes the specified byte to the COM port.

    Methods inherited from class java.io.OutputStream

    close, flush, nullOutputStream

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • write

      public final void write​(int bb) throws java.io.IOException
      Writes the specified byte to the COM port. The general contract for write is that one byte is written to the COM port. The byte to be written is the eight low-order bits of the argument bb. The 24 high-order bits of bb are ignored.
      Specified by:
      write in class java.io.OutputStream
      Parameters:
      bb - The byte.
      Throws:
      java.io.IOException - if an I/O error occurs. In particular, a device disconnection can trigger this error.
    • write

      public final void write​(byte[] buf) throws java.io.IOException
      Writes buf.length bytes from the specified byte array to the COM port. The general contract for write(buf) is that it should have exactly the same effect as the call write(buf, 0, buf.length).
      Overrides:
      write in class java.io.OutputStream
      Parameters:
      buf - The byte array containing the data to be written.
      Throws:
      java.io.IOException - if an I/O error occurs. In particular, a device disconnection can trigger this error.
    • write

      public final void write​(byte[] buf, int off, int len) throws java.io.IOException
      Writes len bytes from the specified byte array starting at offset off to the COM port. The general contract for write(buf, off, len) is that some of the bytes in the array buf are written to the COM port in order. Element buf[off] is the first byte written and buf[off + len - 1] is the last byte written.
      Overrides:
      write in class java.io.OutputStream
      Parameters:
      buf - The byte array containing the data to be written.
      off - The start offset in the data.
      len - The number of bytes to write.
      Throws:
      java.io.IOException - if an I/O error occurs. In particular, a device disconnection can trigger this error.
      java.lang.NullPointerException - if buf is null
      java.lang.IndexOutOfBoundsException - if off is negative, len is negative, or len is greater than buf.length - off