Package htsjdk.samtools.util
Class BufferedLineReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.BufferedReader
-
- java.io.LineNumberReader
-
- htsjdk.samtools.util.BufferedLineReader
-
- All Implemented Interfaces:
LineReader
,Closeable
,AutoCloseable
,Readable
- Direct Known Subclasses:
StringLineReader
public class BufferedLineReader extends LineNumberReader implements LineReader
Implementation of LineReader that is a thin wrapper around BufferedReader. On Linux, this is faster than AsciiLineReaderImpl. If you use AsciiLineReader rather than this class, it will detect the OS and delegate to the preferred implementation.
-
-
Field Summary
-
Fields inherited from interface htsjdk.samtools.util.LineReader
EOF_VALUE
-
-
Constructor Summary
Constructors Constructor Description BufferedLineReader(InputStream is)
BufferedLineReader(InputStream is, int bufferSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static BufferedLineReader
fromString(String s)
Returns aBufferedLineReader
that gets its input from a String.int
peek()
Non-destructive one-character look-ahead.String
readLine()
Read a line and remove the line terminator-
Methods inherited from class java.io.LineNumberReader
getLineNumber, mark, read, read, reset, setLineNumber, skip
-
Methods inherited from class java.io.BufferedReader
lines, markSupported, ready
-
Methods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface htsjdk.samtools.util.LineReader
getLineNumber
-
-
-
-
Constructor Detail
-
BufferedLineReader
public BufferedLineReader(InputStream is)
-
BufferedLineReader
public BufferedLineReader(InputStream is, int bufferSize)
-
-
Method Detail
-
fromString
public static BufferedLineReader fromString(String s)
Returns aBufferedLineReader
that gets its input from a String. No charset conversion is necessary because the String is in unicode.
-
readLine
public String readLine()
Read a line and remove the line terminator- Specified by:
readLine
in interfaceLineReader
- Overrides:
readLine
in classLineNumberReader
- Returns:
- the line read, or null if EOF has been reached.
-
peek
public int peek()
Non-destructive one-character look-ahead.- Specified by:
peek
in interfaceLineReader
- Returns:
- If not eof, the next character that would be read. If eof, -1.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceLineReader
- Overrides:
close
in classBufferedReader
-
-