|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object multigraph.util.LineReader
LineReader is a wrapper class around java.io.Reader that provides for line by line reading of data. Usage is as follows:
Reader rd = ... LineReader lr = new LineReader(rd); String line; while ( (line=lr.readLine()) != null ) { ... }The readLine() method returns the next line (up to but not including the next '\n' character, or to EOF if there are no more such characters) from the Reader. Once EOF is reached on the Reader, readLine() returns null.
Note: readLine skips '\r' characters in the input stream; it neither counts them as part of an end-of-line marker, nor includes them in the string being returned. This is a hack to reasonably deal with both types of end-of-line conventions: ones that use a single '\n', and ones that use a '\r' followed by a '\n'.
Constructor Summary | |
LineReader(java.io.Reader rd)
Create a new LineReader instance using the given Reader object and having the default internal buffer size. |
|
LineReader(java.io.Reader rd,
int bufsize)
Create a new LineReader instance using the given Reader object, and having an internal buffer size
of bufsize . |
Method Summary | |
java.lang.String |
readLine()
Return the next line of characters from the Reader, up to but not including the next '\n' or '\r', or EOF. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LineReader(java.io.Reader rd, int bufsize)
Reader
object, and having an internal buffer size
of bufsize
. We read from the Reader
in
chunks of this size.
rd
- the Reader
to read frombufsize
- length of internal bufferpublic LineReader(java.io.Reader rd)
rd
- the Reader that this LineReader should read fromMethod Detail |
public java.lang.String readLine() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |