Package htsjdk.samtools.seekablestream
Class SeekableBufferedStream
java.lang.Object
java.io.InputStream
htsjdk.samtools.seekablestream.SeekableStream
htsjdk.samtools.seekablestream.SeekableBufferedStream
- All Implemented Interfaces:
Closeable,AutoCloseable
A wrapper class to provide buffered read access to a SeekableStream. Just wrapping such a stream with
a BufferedInputStream will not work as it does not support seeking. In this implementation a
seek call is delegated to the wrapped stream, and the buffer reset.
-
Field Summary
FieldsFields inherited from class htsjdk.samtools.seekablestream.SeekableStream
mark -
Constructor Summary
ConstructorsConstructorDescriptionSeekableBufferedStream(SeekableStream stream) SeekableBufferedStream(SeekableStream stream, int bufferSize) -
Method Summary
Methods inherited from class htsjdk.samtools.seekablestream.SeekableStream
available, mark, markSupported, readFully, resetMethods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE- See Also:
-
-
Constructor Details
-
SeekableBufferedStream
-
SeekableBufferedStream
-
-
Method Details
-
length
public long length()- Specified by:
lengthin classSeekableStream- Returns:
- the length of the stream; 0 if not available or empty.
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
seek
Description copied from class:SeekableStreamSeeks the stream to the provided position.- Specified by:
seekin classSeekableStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Specified by:
readin classSeekableStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classSeekableStream- Throws:
IOException
-
eof
- Specified by:
eofin classSeekableStream- Returns:
trueif the stream is already consumed;falseotherwise.- Throws:
IOException
-
getSource
- Specified by:
getSourcein classSeekableStream- Returns:
- String representation of source (e.g. URL, file path, etc.), or null if not available.
-
position
- Specified by:
positionin classSeekableStream- Returns:
- the current byte position of the stream.
- Throws:
IOException
-