Package htsjdk.samtools.seekablestream
Interface ISeekableStreamFactory
public interface ISeekableStreamFactory
Factory for creating
SeekableStreams based on URLs/paths.
Implementations can be set as the default with SeekableStreamFactory.setInstance(ISeekableStreamFactory)-
Method Summary
Modifier and TypeMethodDescriptiongetBufferedStream(SeekableStream stream) Return a bufferedSeekableStreamwhich wraps the inputstreamusing the default buffer sizegetBufferedStream(SeekableStream stream, int bufferSize) Return a bufferedSeekableStreamwhich wraps the inputstreamgetStreamFor(String path) default SeekableStreamgetStreamFor(String path, Function<SeekableByteChannel, SeekableByteChannel> wrapper) Open a stream from the input path, applying the wrapper to the stream.getStreamFor(URL url)
-
Method Details
-
getStreamFor
- Throws:
IOException
-
getStreamFor
- Throws:
IOException
-
getBufferedStream
Return a bufferedSeekableStreamwhich wraps the inputstreamusing the default buffer size- Parameters:
stream-- Returns:
-
getBufferedStream
Return a bufferedSeekableStreamwhich wraps the inputstream- Parameters:
stream-bufferSize-- Returns:
-
getStreamFor
default SeekableStream getStreamFor(String path, Function<SeekableByteChannel, SeekableByteChannel> wrapper) throws IOExceptionOpen a stream from the input path, applying the wrapper to the stream. The wrapper allows applying operations directly to the byte stream so that things like caching, prefetching, or decryption can be done at the raw byte level. The default implementation throws if wrapper != null, but implementations may support this wrapping operation- Parameters:
path- a uri like String representing a resource to openwrapper- a wrapper to apply to the stream- Returns:
- a stream opened path
- Throws:
IOException
-