public class BufferedLineReader extends Object implements AutoCloseable
nextLine()
, the buffer will be
overwitten!Modifier and Type | Field and Description |
---|---|
protected StringBuilder |
buf
The buffer we read the data into.
|
protected int |
lineNumber
Current line number.
|
private LineReader |
reader
Line reader.
|
Constructor and Description |
---|
BufferedLineReader()
Constructor.
|
BufferedLineReader(InputStream in)
Constructor.
|
BufferedLineReader(InputStreamReader in)
Constructor.
|
BufferedLineReader(LineReader in)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
CharSequence |
getBuffer()
Get the reader buffer.
|
int |
getLineNumber()
Get the current line number.
|
static int |
lengthWithoutLinefeed(CharSequence line)
Get the length of the string, not taking trailing linefeeds into account.
|
boolean |
nextLine()
Read the next line.
|
void |
reset()
Reset the current reader (but do not close the stream).
|
void |
reset(InputStream in)
Reset to a new line reader.
|
void |
reset(InputStreamReader in)
Reset to a new line reader.
|
void |
reset(LineReader r)
Reset to a new line reader.
|
private LineReader reader
protected StringBuilder buf
protected int lineNumber
public BufferedLineReader()
reset()
to assign an input stream.public BufferedLineReader(LineReader in)
in
- Line readerpublic BufferedLineReader(InputStream in)
in
- Input streampublic BufferedLineReader(InputStreamReader in)
in
- Input stream readerpublic void reset()
public void reset(LineReader r)
r
- New readerpublic void reset(InputStream in)
in
- New input stream readerpublic void reset(InputStreamReader in)
in
- New input stream readerpublic CharSequence getBuffer()
nextLine()
, the buffer will be overwitten!public int getLineNumber()
public boolean nextLine() throws IOException
true
if another line was read successfully.IOException
- on IO errors.public void close() throws IOException
close
in interface AutoCloseable
IOException
public static int lengthWithoutLinefeed(CharSequence line)
line
- Input lineCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.