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
- 
Method SummaryModifier and Type Method Description voidwrite(byte[] buf)Writesbuf.lengthbytes from the specified byte array to the COM port.voidwrite(byte[] buf, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto the COM port.voidwrite(int bb)Writes the specified byte to the COM port.
- 
Method Details- 
writepublic final void write(int bb) throws java.io.IOExceptionWrites the specified byte to the COM port. The general contract forwriteis that one byte is written to the COM port. The byte to be written is the eight low-order bits of the argumentbb. The 24 high-order bits ofbbare ignored.- Specified by:
- writein 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.
 
- 
writepublic final void write(byte[] buf) throws java.io.IOExceptionWritesbuf.lengthbytes from the specified byte array to the COM port. The general contract forwrite(buf)is that it should have exactly the same effect as the callwrite(buf, 0, buf.length).- Overrides:
- writein 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.
 
- 
writepublic final void write(byte[] buf, int off, int len) throws java.io.IOExceptionWriteslenbytes from the specified byte array starting at offsetoffto the COM port. The general contract forwrite(buf, off, len)is that some of the bytes in the arraybufare written to the COM port in order. Elementbuf[off]is the first byte written andbuf[off + len - 1]is the last byte written.- Overrides:
- writein 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- bufis- null
- java.lang.IndexOutOfBoundsException- if- offis negative,- lenis negative, or- lenis greater than- buf.length - off
 
 
- 
