LineReader. Line separators are per java.io.BufferedReader : line feed, carriage return,
or carriage return followed immediately by a linefeed.
Subclasses must implement handleLine, call add to pass character data, and
call finish at the end of stream.
| Modifier and Type | Field and Description |
|---|---|
| private StringBuilder | line
Holds partial line contents. |
| private boolean | sawReturn
Whether a line ending with a CR is pending processing. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected void | add(char[]
the character buffer to process cbuf, int the offset into the buffer off, int the number of characters to process len)Process additional characters from the stream. |
| protected void | finish()
Subclasses must call this method after finishing character processing, in order to ensure that
any unterminated line in the buffer is passed to |
| private boolean | |
| protected abstract void | handleLine(String
a line of text (possibly empty), without any line separators line, String the line separator; one of end)"\r", "\n", "\r\n", or ""Called for each line found in the character data passed to |
| line | back to summary |
|---|---|
| private StringBuilder line Holds partial line contents. | |
| sawReturn | back to summary |
|---|---|
| private boolean sawReturn Whether a line ending with a CR is pending processing. | |
| LineBuffer | back to summary |
|---|---|
| pack-priv LineBuffer() | |
| add | back to summary |
|---|---|
| protected void add(char[] cbuf, int off, int len) throws IOException Process additional characters from the stream. When a line separator is found the contents of
the line and the line separator itself are passed to the abstract
| |
| finish | back to summary |
|---|---|
| protected void finish() throws IOException Subclasses must call this method after finishing character processing, in order to ensure that
any unterminated line in the buffer is passed to
| |
| finishLine | back to summary |
|---|---|
| private boolean finishLine(boolean sawNewline) throws IOException Called when a line is complete.
| |
| handleLine | back to summary |
|---|---|
| protected abstract void handleLine(String line, String end) throws IOException Called for each line found in the character data passed to
| |