public class BufferedLineReader
extends java.lang.Object
implements java.lang.AutoCloseable
nextLine()
, the buffer will be
overwitten!Modifier and Type | Field and Description |
---|---|
protected java.lang.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(java.io.InputStream in)
Constructor.
|
BufferedLineReader(java.io.InputStreamReader in)
Constructor.
|
BufferedLineReader(LineReader in)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.lang.CharSequence |
getBuffer()
Get the reader buffer.
|
int |
getLineNumber()
Get the current line number.
|
static int |
lengthWithoutLinefeed(java.lang.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(java.io.InputStream in)
Reset to a new line reader.
|
void |
reset(java.io.InputStreamReader in)
Reset to a new line reader.
|
void |
reset(LineReader r)
Reset to a new line reader.
|
private LineReader reader
protected java.lang.StringBuilder buf
protected int lineNumber
public BufferedLineReader()
reset()
to assign an input stream.public BufferedLineReader(LineReader in)
in
- Line readerpublic BufferedLineReader(java.io.InputStream in)
in
- Input streampublic BufferedLineReader(java.io.InputStreamReader in)
in
- Input stream readerpublic void reset()
public void reset(LineReader r)
r
- New readerpublic void reset(java.io.InputStream in)
in
- New input stream readerpublic void reset(java.io.InputStreamReader in)
in
- New input stream readerpublic java.lang.CharSequence getBuffer()
nextLine()
, the buffer will be overwitten!public int getLineNumber()
public boolean nextLine() throws java.io.IOException
true
if another line was read successfully.java.io.IOException
- on IO errors.public void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
java.io.IOException
public static int lengthWithoutLinefeed(java.lang.CharSequence line)
line
- Input lineCopyright © 2019 ELKI Development Team. License information.