CodecBGZF.BGZFCodec
— TypeBGZFCodec{T, IO} <: Codec
Codec used to compress or decompress data from the input IO source of type IO
. T
must be LibDeflate.Compressor
or LibDeflate.Decompressor
.
CodecBGZF.BGZFCompressorStream
— MethodBGZFCompressorStream(io::IO; threads=nthreads(), compresslevel=6)
Create a TranscodingStream
which block-gzip compresses data from the underlying io
with the given compresslevel
. The stream will compress up to threads
block concurrently.
CodecBGZF.BGZFDecompressorStream
— MethodBGZFDecompressorStream(io::IO; threads=nthreads())
Create a TranscodingStream
which decompresses block-gzipped data from the underlying io
. The stream will compress up to threads
block concurrently.
CodecBGZF.BGZFError
— TypeBGZFError(message::String)
BGZF de/compressor errored with message
when processing data."
CodecBGZF.VirtualOffset
— MethodVirtualOffset(block_offset::Integer, inblock_offset::Integer)
Create a virtual file offset from block_offset
and inblock_offset
. Get the two offsets with offsets(v)
.
block_offset
is an offset pointing to the beginning position of a BGZF block in a BGZF file and inblock_offset
is an offset pointing to the begining position of a binary data within a uncompressed BGZF block. These values are zero-based and their valid ranges are [0, 1 << 48) and [0, 1 << 16), respectively.
CodecBGZF.VirtualOffset
— MethodVirtualOffset(stream::BGZFDecompressorStream)
Obtain the VirtualOffset
of the curret position of stream
. If stream's
input stream is seekable, seeking to this offset will leave the stream in an equivalent state to its current state. A BGZFDecompressorStream
only tracks the offset of the 16 previous blocks. If more than 16 blocks are stored in stream
's output buffer, this operation will fail.
Base.seek
— Methodseek(stream::BGZFDecompressorStream, v::VirtualOffset)
Seek stream
to the given VirtualOffset
v
. v
must be a valid virtual offset for the given stream
, i.e. its coffset must be the offset of a valid BGZF block, and its uoffset must be an integer in [0, block_len]. Furthermore, stream
's underlying stream must be seekable.
Base.seekstart
— Methodseekstart(stream::BGZFDecompressorStream)
Seek the stream
's input stream to its beginning, and resets the stream
.
CodecBGZF.copy_from_outbuffer
— MethodReturn data already prepared in the current block
CodecBGZF.get_new_offset
— MethodGet the offset for the soon-to-be indexed block based on the previous block
CodecBGZF.get_new_offset
— MethodGet the offset for the soon-to-be indexed block based on the previous block
CodecBGZF.gzi
— Methodgzi(io::IO)
Construct a Vector{UInt8}
with the GZI of a BGZF file of an IO
representing a BGZF file. GZI files contain offsets for each block and its decompressed payload in a BGZF file. A GZI file is approximately 1/4000th the size of the decompressed data in a BGZF file.
Examples
julia open(gzi, "/my/bgzip/file.bgz")
102744-element Array{UInt8,1}:
0x15
0x19
0x00
0x00
0x00
[ ... ]
CodecBGZF.increment_block!
— MethodSwitches the code to the next block to process, given whether the input stream is eof. Returns block index, or nothing if there are no more blocks to process
CodecBGZF.index!
— MethodGet relevant positions of the compressed block in data
CodecBGZF.load_block!
— FunctionPrepare the block to be de/compressed. Unlike the queue operation, the loading function may mutate the codec, and is therefore not threadsafe.
CodecBGZF.push_offsets!
— MethodAdd the current block's offsets and lengths to the codex offset vector
CodecBGZF.queue!
— MethodProcess the block in another thread
CodecBGZF.remaining
— MethodGet number of remaning bytes in the codec's buffer before a new block can be indexed