|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.io.SlowLineReader
public class SlowLineReader
Reads complete lines from an InputStream. This is designed not to block if the input stream is reading from a slow source like a serial port.
| Constructor Summary | |
|---|---|
SlowLineReader(java.io.InputStream in)
|
|
| Method Summary | |
|---|---|
void |
close()
|
java.lang.StringBuffer |
getLastRead()
Returns the new bytes we found in the last call to readLine(). |
java.lang.String |
readLine()
Returns null if it can't read a complete line. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SlowLineReader(java.io.InputStream in)
| Method Detail |
|---|
public void close()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.StringBuffer getLastRead()
public java.lang.String readLine()
throws java.io.IOException
Returns null if it can't read a complete line. Internally, this function stops reading if it reaches the end of a complete line or if the next read would block.
If there baud rate is set incorrectly or there is too much line noise, there is never a complete line, and the accumulation buffer overflows. To counter that, this function gives up looking for a complete line and returns what is has read if the accumulated partial line is longer than 160 characters, which is twice the length of a normal NMEA line.
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||