Package htsjdk.samtools.util
Class FastLineReader
- java.lang.Object
-
- htsjdk.samtools.util.FastLineReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class FastLineReader extends Object implements Closeable
Line-oriented InputStream reader that uses one buffer for disk buffering and line-termination-finding, in order to improve performance. Implementation detail: All public methods must leave the input buffer in a non-empty state, unless at EOF.
-
-
Constructor Summary
Constructors Constructor Description FastLineReader(InputStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
atEoln()
void
close()
boolean
eof()
byte
getByte()
byte
peekByte()
int
readToEndOfOutputBufferOrEoln(byte[] outputBuffer, int startOutputIndex)
Read from input until input is exhausted, EOLN is seen, or output buffer is filledboolean
skipNewlines()
Advance over any EOLN chars (CR or LF)
-
-
-
Constructor Detail
-
FastLineReader
public FastLineReader(InputStream in)
-
-
Method Detail
-
eof
public boolean eof()
- Returns:
- true if input is exhausted
-
atEoln
public boolean atEoln()
- Returns:
- peeks at the next byte in the stream and returns true if it is CR or LF. Returns false if EOF or next byte is not CR or LF.
-
skipNewlines
public boolean skipNewlines()
Advance over any EOLN chars (CR or LF)- Returns:
- true if saw one or more CR or LFs
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getByte
public byte getByte()
- Returns:
- Next byte from the input. Do not call if at EOF.
-
peekByte
public byte peekByte()
- Returns:
- Next byte from the input, without advancing over that byte. Do not call if at EOF.
-
readToEndOfOutputBufferOrEoln
public int readToEndOfOutputBufferOrEoln(byte[] outputBuffer, int startOutputIndex)
Read from input until input is exhausted, EOLN is seen, or output buffer is filled- Parameters:
outputBuffer
- where to put bytes readstartOutputIndex
- where to start putting bytes read- Returns:
- number of bytes read
-
-