public class BlockCompressedInputStream extends java.io.InputStream implements LocationAware
Modifier and Type | Class and Description |
---|---|
static class |
BlockCompressedInputStream.FileTermination |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CANNOT_SEEK_STREAM_MSG |
static java.lang.String |
INCORRECT_HEADER_SIZE_MSG |
static java.lang.String |
INVALID_FILE_PTR_MSG |
static java.lang.String |
PREMATURE_END_MSG |
static java.lang.String |
UNEXPECTED_BLOCK_LENGTH_MSG |
Constructor and Description |
---|
BlockCompressedInputStream(java.io.File file)
Use this ctor if you wish to call seek()
|
BlockCompressedInputStream(java.io.InputStream stream)
Note that seek() is not supported if this ctor is used.
|
BlockCompressedInputStream(java.io.InputStream stream,
boolean allowBuffering)
Note that seek() is not supported if this ctor is used.
|
BlockCompressedInputStream(SeekableStream strm)
For providing some arbitrary data source.
|
BlockCompressedInputStream(java.net.URL url) |
Modifier and Type | Method and Description |
---|---|
static void |
assertNonDefectiveFile(java.io.File file) |
int |
available() |
static BlockCompressedInputStream.FileTermination |
checkTermination(java.io.File file) |
void |
close()
Closes the underlying InputStream or RandomAccessFile
|
boolean |
endOfBlock() |
static long |
getFileBlock(long bgzfOffset) |
long |
getFilePointer() |
long |
getPosition()
The current offset, in bytes, of this stream/writer/file.
|
static boolean |
isValidFile(java.io.InputStream stream) |
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] buffer)
Reads some number of bytes from the input stream and stores them into the buffer array b.
|
int |
read(byte[] buffer,
int offset,
int length)
Reads up to len bytes of data from the input stream into an array of bytes.
|
java.lang.String |
readLine()
Reads a whole line.
|
void |
seek(long pos)
Seek to the given position in the file.
|
void |
setCheckCrcs(boolean check)
Determines whether or not the inflater will re-calculated the CRC on the decompressed data
and check it against the value stored in the GZIP header.
|
public static final java.lang.String INCORRECT_HEADER_SIZE_MSG
public static final java.lang.String UNEXPECTED_BLOCK_LENGTH_MSG
public static final java.lang.String PREMATURE_END_MSG
public static final java.lang.String CANNOT_SEEK_STREAM_MSG
public static final java.lang.String INVALID_FILE_PTR_MSG
public BlockCompressedInputStream(java.io.InputStream stream)
public BlockCompressedInputStream(java.io.InputStream stream, boolean allowBuffering)
public BlockCompressedInputStream(java.io.File file) throws java.io.IOException
java.io.IOException
public BlockCompressedInputStream(java.net.URL url)
public BlockCompressedInputStream(SeekableStream strm)
public void setCheckCrcs(boolean check)
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public boolean endOfBlock()
true
if the stream is at the end of a BGZF block,
false
otherwise.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] buffer) throws java.io.IOException
read
in class java.io.InputStream
buffer
- the buffer into which the data is read.java.io.IOException
public java.lang.String readLine() throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic int read(byte[] buffer, int offset, int length) throws java.io.IOException
read
in class java.io.InputStream
buffer
- buffer into which data is read.offset
- the start offset in array b at which the data is written.length
- the maximum number of bytes to read.java.io.IOException
public void seek(long pos) throws java.io.IOException
pos
- virtual file pointerjava.io.IOException
public long getFilePointer()
public long getPosition()
LocationAware
getPosition
in interface LocationAware
public static long getFileBlock(long bgzfOffset)
public static boolean isValidFile(java.io.InputStream stream) throws java.io.IOException
stream
- Must be at start of file. Throws RuntimeException if !stream.markSupported().java.io.IOException
public static BlockCompressedInputStream.FileTermination checkTermination(java.io.File file) throws java.io.IOException
java.io.IOException
public static void assertNonDefectiveFile(java.io.File file) throws java.io.IOException
java.io.IOException