public class SerialReader extends Object implements jssc.SerialPortEventListener, Closeable
Constructor and Description |
---|
SerialReader(InputStream in,
SerialDataParser parser)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addSerialDataListener(SerialDataListener listener)
Add a serial data listener that will be informed of individual tokens
that are parsed from the parser.
|
void |
close() |
protected void |
fireDataReceived(String[] strings)
Fire multiple events: one for each parsed string.
|
void |
removeSerialDataListener(SerialDataListener listener)
Remove the given listener from this reader.
|
void |
serialEvent(jssc.SerialPortEvent event) |
void |
setMaxBufferSize(int maxSize)
Set the size of the buffer to use.
|
public SerialReader(InputStream in, SerialDataParser parser)
in
- parser
- public void serialEvent(jssc.SerialPortEvent event)
serialEvent
in interface jssc.SerialPortEventListener
public void addSerialDataListener(SerialDataListener listener)
listener
- The listenerpublic void removeSerialDataListener(SerialDataListener listener)
listener
- The listenerprotected void fireDataReceived(String[] strings)
strings
- The strings parsed from the parser.public void setMaxBufferSize(int maxSize)
maxSize
- The size of the buffer to use.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException