Functions
fn decodeBlock(dest: []u8, src: []const u8, block_header: frame.Zstandard.Block.Header, decode_state: *DecodeState, consumed_count: *usize, block_size_max: usize, written_count: usize) error{DestTooSmall} || Error!usize
Decode a single block from
src
intodest
. The beginning ofsrc
must be th…Decode a single block from
src
intodest
. The beginning ofsrc
must be the start of the block content (i.e. directly after the block header). Incrementsconsumed_count
by the number of bytes read fromsrc
to decode the block and returns the decompressed size of the block.Errors returned:
error.BlockSizeOverMaximum
if block’s size is larger than 1 << 17 ordest[written_count..].len
error.MalformedBlockSize
ifsrc.len
is smaller than the block size and the block is a raw or compressed blockerror.ReservedBlock
if the block is a reserved blockerror.MalformedRleBlock
if the block is an RLE block andsrc.len < 1
error.MalformedCompressedBlock
if there are errors decoding a compressed blockerror.DestTooSmall
isdest
is not large enough to hold the decompressed block
fn decodeBlockHeaderSlice(src: []const u8) error{EndOfStream}!frame.Zstandard.Block.Header
Decode the header of a block.
Decode the header of a block.
Errors returned:
error.EndOfStream
ifsrc.len < 3
fn decodeBlockReader(dest: *RingBuffer, source: anytype, block_header: frame.Zstandard.Block.Header, decode_state: *DecodeState, block_size_max: usize, literals_buffer: []u8, sequence_buffer: []u8) !void
Decode a single block from
source
intodest
. Literal and sequence data from…Decode a single block from
source
intodest
. Literal and sequence data from the block is copied intoliterals_buffer
andsequence_buffer
, which must be large enough orerror.LiteralsBufferTooSmall
anderror.SequenceBufferTooSmall
are returned (the maximum block size is an upper bound for the size of both buffers). SeedecodeBlock
anddecodeBlockRingBuffer
for function that can decode a block without these extra copies.error.EndOfStream
is returned ifsource
does not contain enough bytes.fn decodeBlockRingBuffer(dest: *RingBuffer, src: []const u8, block_header: frame.Zstandard.Block.Header, decode_state: *DecodeState, consumed_count: *usize, block_size_max: usize) Error!usize
Decode a single block from
src
intodest
; seedecodeBlock()
. Returns the …Decode a single block from
src
intodest
; seedecodeBlock()
. Returns the size of the decompressed block, which can be used withdest.sliceLast()
to get the decompressed bytes.error.BlockSizeOverMaximum
is returned if the block’s compressed or decompressed size is larger thanblock_size_max
.fn decodeLiteralsHeader(source: anytype) !LiteralsSection.Header
Decode a literals section header.
Decode a literals section header.
Errors returned:
error.EndOfStream
if there are not enough bytes insource
fn decodeLiteralsSection(source: anytype, buffer: []u8) !LiteralsSection
Decode a
LiteralsSection
fromsrc
, incrementingconsumed_count
by the num…Decode a
LiteralsSection
fromsrc
, incrementingconsumed_count
by the number of bytes the section uses. SeedecodeLiterasSectionSlice()
.fn decodeLiteralsSectionSlice(src: []const u8, consumed_count: *usize) error{MalformedLiteralsHeader, MalformedLiteralsSection, EndOfStream} || huffman.Error!LiteralsSection
Decode a
LiteralsSection
fromsrc
, incrementingconsumed_count
by the num…Decode a
LiteralsSection
fromsrc
, incrementingconsumed_count
by the number of bytes the section uses.Errors returned:
error.MalformedLiteralsHeader
if the header is invaliderror.MalformedLiteralsSection
if there are decoding errorserror.MalformedAccuracyLog
if compressed literals have invalid accuracyerror.MalformedFseTable
if compressed literals have invalid FSE tableerror.MalformedHuffmanTree
if there are errors decoding a Huffamn treeerror.EndOfStream
if there are not enough bytes insrc
fn decodeSequencesHeader(source: anytype) !SequencesSection.Header
Decode a sequences section header.
Decode a sequences section header.
Errors returned:
error.ReservedBitSet
if the reserved bit is seterror.EndOfStream
if there are not enough bytes insource