Namespaces

Functions

fn computeChecksum(hasher: *std.hash.XxHash64) u32

Returns the frame checksum corresponding to the data fed into hasher

fn decode(dest: []u8, src: []const u8, verify_checksum: bool) error{MalformedFrame, UnknownContentSizeUnsupported, DictionaryIdFlagUnsupported}!usize

Decodes frames from src into dest; returns the length of the result. The st…

Decodes frames from src into dest; returns the length of the result. The stream should not have extra trailing bytes - either all bytes in src will be decoded, or an error will be returned. An error will be returned if a Zstandard frame in src does not declare its content size.

Errors returned:

  • error.DictionaryIdFlagUnsupported if a src contains a frame that uses a dictionary
  • error.MalformedFrame if a frame in src is invalid
  • error.UnknownContentSizeUnsupported if a frame in src does not declare its content size
fn decodeAlloc(allocator: Allocator, src: []const u8, verify_checksum: bool, window_size_max: usize) error{DictionaryIdFlagUnsupported, MalformedFrame, OutOfMemory}![]u8

Decodes a stream of frames from src; returns the decoded bytes. The stream sh…

Decodes a stream of frames from src; returns the decoded bytes. The stream should not have extra trailing bytes - either all bytes in src will be decoded, or an error will be returned.

Errors returned:

  • error.DictionaryIdFlagUnsupported if a src contains a frame that uses a dictionary
  • error.MalformedFrame if a frame in src is invalid
  • error.OutOfMemory if allocator cannot allocate enough memory
fn decodeFrame(dest: []u8, src: []const u8, verify_checksum: bool) error{BadMagic, UnknownContentSizeUnsupported, ContentTooLarge, ContentSizeTooLarge, WindowSizeUnknown, DictionaryIdFlagUnsupported, SkippableSizeTooLarge} || FrameError!ReadWriteCount

Decodes the frame at the start of src into dest. Returns the number of byte…

Decodes the frame at the start of src into dest. Returns the number of bytes read from src and written to dest. This function can only decode frames that declare the decompressed content size.

Errors returned:

  • error.BadMagic if the first 4 bytes of src is not a valid magic number for a Zstandard or skippable frame
  • error.UnknownContentSizeUnsupported if the frame does not declare the uncompressed content size
  • error.WindowSizeUnknown if the frame does not have a valid window size
  • error.ContentTooLarge if dest is smaller than the uncompressed data size declared by the frame header
  • error.ContentSizeTooLarge if the frame header indicates a content size that is larger than std.math.maxInt(usize)
  • error.DictionaryIdFlagUnsupported if the frame uses a dictionary
  • error.ChecksumFailure if verify_checksum is true and the frame contains a checksum that does not match the checksum of the decompressed data
  • error.ReservedBitSet if any of the reserved bits of the frame header are set
  • error.EndOfStream if src does not contain a complete frame
  • error.BadContentSize if the content size declared by the frame does not equal the actual size of decompressed data
  • an error in block.Error if there are errors decoding a block
  • error.SkippableSizeTooLarge if the frame is skippable and reports a size greater than src.len
fn decodeFrameArrayList(allocator: Allocator, dest: *field_call, src: []const u8, verify_checksum: bool, window_size_max: usize) error{BadMagic, OutOfMemory, SkippableSizeTooLarge} || FrameContext.Error || FrameError!usize

Decodes the frame at the start of src into dest. Returns the number of byte…

Decodes the frame at the start of src into dest. Returns the number of bytes read from src.

Errors returned:

  • error.BadMagic if the first 4 bytes of src is not a valid magic number for a Zstandard or skippable frame
  • error.WindowSizeUnknown if the frame does not have a valid window size
  • error.WindowTooLarge if the window size is larger than window_size_max
  • error.ContentSizeTooLarge if the frame header indicates a content size that is larger than std.math.maxInt(usize)
  • error.DictionaryIdFlagUnsupported if the frame uses a dictionary
  • error.ChecksumFailure if verify_checksum is true and the frame contains a checksum that does not match the checksum of the decompressed data
  • error.ReservedBitSet if any of the reserved bits of the frame header are set
  • error.EndOfStream if src does not contain a complete frame
  • error.BadContentSize if the content size declared by the frame does not equal the actual size of decompressed data
  • error.OutOfMemory if allocator cannot allocate enough memory
  • an error in block.Error if there are errors decoding a block
  • error.SkippableSizeTooLarge if the frame is skippable and reports a size greater than src.len
fn decodeFrameHeader(source: anytype) @TypeOf(source).Error || HeaderError!FrameHeader

Returns the header of the frame at the beginning of source.

Returns the header of the frame at the beginning of source.

Errors returned:

  • error.BadMagic if source begins with bytes not equal to the Zstandard frame magic number, or outside the range of magic numbers for skippable frames.
  • error.EndOfStream if source contains fewer than 4 bytes
  • error.ReservedBitSet if the frame is a Zstandard frame and any of the reserved bits are set
fn decodeFrameType(source: anytype) error{BadMagic, EndOfStream}!frame.Kind

Returns the kind of frame at the beginning of source.

Returns the kind of frame at the beginning of source.

Errors returned:

  • error.BadMagic if source begins with bytes not equal to the Zstandard frame magic number, or outside the range of magic numbers for skippable frames.
  • error.EndOfStream if source contains fewer than 4 bytes
fn decodeSkippableHeader(src: *const [8]u8) SkippableHeader

Decode the header of a skippable frame. The first four bytes of src must be a…

Decode the header of a skippable frame. The first four bytes of src must be a valid magic number for a skippable frame.

fn decodeZStandardFrameBlocks(dest: []u8, src: []const u8, frame_context: *FrameContext) error{ContentTooLarge, UnknownContentSizeUnsupported} || FrameError!ReadWriteCount

No documentation provided.

fn decodeZstandardFrame(dest: []u8, src: []const u8, verify_checksum: bool) error{UnknownContentSizeUnsupported, ContentTooLarge, ContentSizeTooLarge, WindowSizeUnknown, DictionaryIdFlagUnsupported} || FrameError!ReadWriteCount

Decode a Zstandard frame from src into dest, returning the number of bytes …

Decode a Zstandard frame from src into dest, returning the number of bytes read from src and written to dest. The first four bytes of src must be the magic number for a Zstandard frame.

Error returned:

  • error.UnknownContentSizeUnsupported if the frame does not declare the uncompressed content size
  • error.ContentTooLarge if dest is smaller than the uncompressed data size declared by the frame header
  • error.WindowSizeUnknown if the frame does not have a valid window size
  • error.DictionaryIdFlagUnsupported if the frame uses a dictionary
  • error.ContentSizeTooLarge if the frame header indicates a content size that is larger than std.math.maxInt(usize)
  • error.ChecksumFailure if verify_checksum is true and the frame contains a checksum that does not match the checksum of the decompressed data
  • error.ReservedBitSet if the reserved bit of the frame header is set
  • error.EndOfStream if src does not contain a complete frame
  • an error in block.Error if there are errors decoding a block
  • error.BadContentSize if the content size declared by the frame does not equal the actual size of decompressed data
fn decodeZstandardFrameArrayList(allocator: Allocator, dest: *field_call, src: []const u8, verify_checksum: bool, window_size_max: usize) error{OutOfMemory} || FrameContext.Error || FrameError!usize

Decode a Zstandard from from src and return number of bytes read; see `decode…

Decode a Zstandard from from src and return number of bytes read; see decodeZstandardFrame(). The first four bytes of src must be the magic number for a Zstandard frame.

Errors returned:

  • error.WindowSizeUnknown if the frame does not have a valid window size
  • error.WindowTooLarge if the window size is larger than window_size_max
  • error.DictionaryIdFlagUnsupported if the frame uses a dictionary
  • error.ContentSizeTooLarge if the frame header indicates a content size that is larger than std.math.maxInt(usize)
  • error.ChecksumFailure if verify_checksum is true and the frame contains a checksum that does not match the checksum of the decompressed data
  • error.ReservedBitSet if the reserved bit of the frame header is set
  • error.EndOfStream if src does not contain a complete frame
  • error.OutOfMemory if allocator cannot allocate enough memory
  • an error in block.Error if there are errors decoding a block
  • error.BadContentSize if the content size declared by the frame does not equal the size of decompressed data
fn decodeZstandardFrameBlocksArrayList(allocator: Allocator, dest: *field_call, src: []const u8, frame_context: *FrameContext) error{OutOfMemory} || FrameError!usize

No documentation provided.

fn decodeZstandardHeader(source: anytype) @TypeOf(source).Error || error{EndOfStream, ReservedBitSet}!ZstandardHeader

Decode the header of a Zstandard frame.

Decode the header of a Zstandard frame.

Errors returned:

  • error.ReservedBitSet if any of the reserved bits of the header are set
  • error.EndOfStream if source does not contain a complete header
fn frameType(magic: u32) error{BadMagic}!frame.Kind

Returns the kind of frame associated to magic.

Returns the kind of frame associated to magic.

Errors returned:

  • error.BadMagic if magic is not a valid magic number.
fn frameWindowSize(header: ZstandardHeader) ?u64

Returns the window size required to decompress a frame, or null if it cannot …

Returns the window size required to decompress a frame, or null if it cannot be determined (which indicates a malformed frame header).

fn isSkippableMagic(magic: u32) bool

Returns true is magic is a valid magic number for a skippable frame

Error Sets