|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jsefa.common.lowlevel.io.LineSegmentReader
public class LineSegmentReader
A reader for reading LineSegment
s from a stream.
Constructor Summary | |
---|---|
LineSegmentReader(Reader reader)
Constructs a new LineSegmentReader . |
|
LineSegmentReader(Reader reader,
int bufferSize,
int minBufferFilling,
int bufferEnlargement)
Constructs a new LineSegmentReader . |
Method Summary | |
---|---|
void |
close()
Closes the stream. |
InputPosition |
getInputPosition()
Returns information about the current position within the input stream. |
void |
mark()
Marks the current position in the stream so that calling reset(boolean) will return to this position. |
LineSegment |
read()
Reads a LineSegment from the stream. |
LineSegment |
read(int limit)
Reads a LineSegment from the stream with an upper bound for the length of its content. |
LineSegment |
read(int specialTerminator,
int limit)
Reads a LineSegment from the stream. |
void |
removeMarker()
Removes the marker. |
void |
reset(boolean removeMarker)
Moves back to the position marked with mark() before. |
void |
skipLine()
Skips the current line, i. e. moves to the character after the next line break. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineSegmentReader(Reader reader)
LineSegmentReader
.
reader
- the reader to access the stream withpublic LineSegmentReader(Reader reader, int bufferSize, int minBufferFilling, int bufferEnlargement)
LineSegmentReader
.
reader
- the reader to access the stream withbufferSize
- the initial size of the character bufferminBufferFilling
- the minimum number of characters to fill the buffer with. Only relevant when a mark is
set.bufferEnlargement
- the number of characters to enlarge the buffer if it gets too small. Only relevant when
a mark is set.Method Detail |
---|
public LineSegment read() throws IOException
LineSegment
from the stream.
The segment is terminated either with a line break or end of stream.
LineSegment
or null if there are no characters left on the stream
IOException
- if an I/O error occurspublic LineSegment read(int limit) throws IOException
LineSegment
from the stream with an upper bound for the length of its content.
The segment is either terminated (with a line break or end of stream) or not (if the limit is reached).
limit
- the upper bound for the size of the LineSegment
(length of its content).
LineSegment
or null if there are no characters left on the stream
IOException
- if an I/O error occurspublic LineSegment read(int specialTerminator, int limit) throws IOException
LineSegment
from the stream.
specialTerminator
- the character to use as a special terminator for the LineSegement
or -1, if
only the standard terminators shall be used.limit
- the upper bound for the size of the LineSegment
(length of its content).
LineSegment
or null if there are no characters left on the stream
IOException
- if an I/O error occurspublic void skipLine() throws IOException
IOException
- if an I/O error occurspublic InputPosition getInputPosition()
public void mark()
reset(boolean)
will return to this position.
Note: You should remove the marker with removeMarker()
if you do not need it any more.
public void reset(boolean removeMarker)
mark()
before.
removeMarker
- true, if the marker should be removed afterwardspublic void removeMarker()
public void close() throws IOException
IOException
- if an I/O error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |