|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.ka2ddo.yaac.io.CloseableWhileReadingSerialInputStream
public class CloseableWhileReadingSerialInputStream
This class is a wrapper around a RXTX SerialPort's SerialInputStream, so that the SerialPort can be closed while a blocking read is outstanding and properly abort the read.
Constructor Summary | |
---|---|
CloseableWhileReadingSerialInputStream(gnu.io.SerialPort serialPort)
|
Method Summary | |
---|---|
int |
available()
Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream. |
void |
close()
Closes this input stream and releases any system resources associated with the stream. |
boolean |
markSupported()
Tests if this input stream supports the mark and
reset methods. |
int |
read()
Reads the next byte of data from the input stream. |
void |
serialEvent(gnu.io.SerialPortEvent ev)
|
Methods inherited from class java.io.InputStream |
---|
mark, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CloseableWhileReadingSerialInputStream(gnu.io.SerialPort serialPort) throws java.io.IOException, java.util.TooManyListenersException
java.io.IOException
java.util.TooManyListenersException
Method Detail |
---|
public int read() throws java.io.IOException
int
in the range 0
to
255
. If no byte is available because the end of the stream
has been reached, the value -1
is returned. This method
blocks until input data is available, the end of the stream is detected,
or an exception is thrown.
read
in class java.io.InputStream
-1
if the end of the
stream is reached.
java.io.IOException
- if an I/O error occurs.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.public int available() throws java.io.IOException
available
in class java.io.InputStream
0
when
it reaches the end of the input stream.
java.io.IOException
- if an I/O error occurs.public boolean markSupported()
mark
and
reset
methods. Whether or not mark
and
reset
are supported is an invariant property of a
particular input stream instance. The markSupported
method
returns false
.
markSupported
in class java.io.InputStream
true
if this stream instance supports the mark
and reset methods; false
otherwise.InputStream.mark(int)
,
InputStream.reset()
public void serialEvent(gnu.io.SerialPortEvent ev)
serialEvent
in interface gnu.io.SerialPortEventListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |