Types

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 into dest. The beginning of src must be th…

Decode a single block from src into dest. The beginning of src must be the start of the block content (i.e. directly after the block header). Increments consumed_count by the number of bytes read from src 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 or dest[written_count..].len
  • error.MalformedBlockSize if src.len is smaller than the block size and the block is a raw or compressed block
  • error.ReservedBlock if the block is a reserved block
  • error.MalformedRleBlock if the block is an RLE block and src.len < 1
  • error.MalformedCompressedBlock if there are errors decoding a compressed block
  • error.DestTooSmall is dest is not large enough to hold the decompressed block
fn decodeBlockHeader(src: *const [3]u8) frame.Zstandard.Block.Header

Decode the header of a 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 if src.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 into dest. Literal and sequence data from…

Decode a single block from source into dest. Literal and sequence data from the block is copied into literals_buffer and sequence_buffer, which must be large enough or error.LiteralsBufferTooSmall and error.SequenceBufferTooSmall are returned (the maximum block size is an upper bound for the size of both buffers). See decodeBlock and decodeBlockRingBuffer for function that can decode a block without these extra copies. error.EndOfStream is returned if source 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 into dest; see decodeBlock(). Returns the …

Decode a single block from src into dest; see decodeBlock(). Returns the size of the decompressed block, which can be used with dest.sliceLast() to get the decompressed bytes. error.BlockSizeOverMaximum is returned if the block’s compressed or decompressed size is larger than block_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 in source
fn decodeLiteralsSection(source: anytype, buffer: []u8) !LiteralsSection

Decode a LiteralsSection from src, incrementing consumed_count by the num…

Decode a LiteralsSection from src, incrementing consumed_count by the number of bytes the section uses. See decodeLiterasSectionSlice().

fn decodeLiteralsSectionSlice(src: []const u8, consumed_count: *usize) error{MalformedLiteralsHeader, MalformedLiteralsSection, EndOfStream} || huffman.Error!LiteralsSection

Decode a LiteralsSection from src, incrementing consumed_count by the num…

Decode a LiteralsSection from src, incrementing consumed_count by the number of bytes the section uses.

Errors returned:

  • error.MalformedLiteralsHeader if the header is invalid
  • error.MalformedLiteralsSection if there are decoding errors
  • error.MalformedAccuracyLog if compressed literals have invalid accuracy
  • error.MalformedFseTable if compressed literals have invalid FSE table
  • error.MalformedHuffmanTree if there are errors decoding a Huffamn tree
  • error.EndOfStream if there are not enough bytes in src
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 set
  • error.EndOfStream if there are not enough bytes in source

Error Sets