Package htsjdk.samtools.util
Class AsyncBlockCompressedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- htsjdk.samtools.util.BlockCompressedInputStream
-
- htsjdk.samtools.util.AsyncBlockCompressedInputStream
-
- All Implemented Interfaces:
LocationAware,Closeable,AutoCloseable
public class AsyncBlockCompressedInputStream extends BlockCompressedInputStream
Asynchronous read-ahead implementation ofBlockCompressedInputStream. Note that this implementation is not synchronized. If multiple threads access an instance concurrently, it must be synchronized externally.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class htsjdk.samtools.util.BlockCompressedInputStream
BlockCompressedInputStream.DecompressedBlock, BlockCompressedInputStream.FileTermination
-
-
Field Summary
-
Fields inherited from class htsjdk.samtools.util.BlockCompressedInputStream
CANNOT_SEEK_CLOSED_STREAM_MSG, CANNOT_SEEK_STREAM_MSG, INCORRECT_HEADER_SIZE_MSG, INVALID_FILE_PTR_MSG, PREMATURE_END_MSG, UNEXPECTED_BLOCK_LENGTH_MSG
-
-
Constructor Summary
Constructors Constructor Description AsyncBlockCompressedInputStream(SeekableStream strm)AsyncBlockCompressedInputStream(SeekableStream strm, InflaterFactory inflaterFactory)AsyncBlockCompressedInputStream(File file)AsyncBlockCompressedInputStream(File file, InflaterFactory inflaterFactory)AsyncBlockCompressedInputStream(InputStream stream)AsyncBlockCompressedInputStream(InputStream stream, InflaterFactory inflaterFactory)AsyncBlockCompressedInputStream(URL url)AsyncBlockCompressedInputStream(URL url, InflaterFactory inflaterFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying InputStream or RandomAccessFileprotected BlockCompressedInputStream.DecompressedBlocknextBlock(byte[] bufferAvailableForReuse)Reads and decompresses the next blockprotected voidprepareForSeek()Performs cleanup required before seek is called on the underlying stream-
Methods inherited from class htsjdk.samtools.util.BlockCompressedInputStream
assertNonDefectiveFile, available, checkTermination, checkTermination, checkTermination, endOfBlock, getFileBlock, getFilePointer, getPosition, isValidFile, processNextBlock, read, read, read, readLine, seek, setCheckCrcs
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(InputStream stream)
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(InputStream stream, InflaterFactory inflaterFactory)
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(File file) throws IOException
- Throws:
IOException
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(File file, InflaterFactory inflaterFactory) throws IOException
- Throws:
IOException
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(URL url)
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(URL url, InflaterFactory inflaterFactory)
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(SeekableStream strm)
-
AsyncBlockCompressedInputStream
public AsyncBlockCompressedInputStream(SeekableStream strm, InflaterFactory inflaterFactory)
-
-
Method Detail
-
nextBlock
protected BlockCompressedInputStream.DecompressedBlock nextBlock(byte[] bufferAvailableForReuse)
Description copied from class:BlockCompressedInputStreamReads and decompresses the next block- Overrides:
nextBlockin classBlockCompressedInputStream- Parameters:
bufferAvailableForReuse- decompression buffer available for reuse- Returns:
- next block in the decompressed stream
-
prepareForSeek
protected void prepareForSeek()
Description copied from class:BlockCompressedInputStreamPerforms cleanup required before seek is called on the underlying stream- Overrides:
prepareForSeekin classBlockCompressedInputStream
-
close
public void close() throws IOExceptionDescription copied from class:BlockCompressedInputStreamCloses the underlying InputStream or RandomAccessFile- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classBlockCompressedInputStream- Throws:
IOException
-
-