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
intodest
; returns the length of the result. The st…Decodes frames from
src
intodest
; returns the length of the result. The stream should not have extra trailing bytes - either all bytes insrc
will be decoded, or an error will be returned. An error will be returned if a Zstandard frame insrc
does not declare its content size.Errors returned:
error.DictionaryIdFlagUnsupported
if asrc
contains a frame that uses a dictionaryerror.MalformedFrame
if a frame insrc
is invaliderror.UnknownContentSizeUnsupported
if a frame insrc
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 insrc
will be decoded, or an error will be returned.Errors returned:
error.DictionaryIdFlagUnsupported
if asrc
contains a frame that uses a dictionaryerror.MalformedFrame
if a frame insrc
is invaliderror.OutOfMemory
ifallocator
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
intodest
. Returns the number of byte…Decodes the frame at the start of
src
intodest
. Returns the number of bytes read fromsrc
and written todest
. This function can only decode frames that declare the decompressed content size.Errors returned:
error.BadMagic
if the first 4 bytes ofsrc
is not a valid magic number for a Zstandard or skippable frameerror.UnknownContentSizeUnsupported
if the frame does not declare the uncompressed content sizeerror.WindowSizeUnknown
if the frame does not have a valid window sizeerror.ContentTooLarge
ifdest
is smaller than the uncompressed data size declared by the frame headererror.ContentSizeTooLarge
if the frame header indicates a content size that is larger thanstd.math.maxInt(usize)
error.DictionaryIdFlagUnsupported
if the frame uses a dictionaryerror.ChecksumFailure
ifverify_checksum
is true and the frame contains a checksum that does not match the checksum of the decompressed dataerror.ReservedBitSet
if any of the reserved bits of the frame header are seterror.EndOfStream
ifsrc
does not contain a complete frameerror.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 thansrc.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
intodest
. Returns the number of byte…Decodes the frame at the start of
src
intodest
. Returns the number of bytes read fromsrc
.Errors returned:
error.BadMagic
if the first 4 bytes ofsrc
is not a valid magic number for a Zstandard or skippable frameerror.WindowSizeUnknown
if the frame does not have a valid window sizeerror.WindowTooLarge
if the window size is larger thanwindow_size_max
error.ContentSizeTooLarge
if the frame header indicates a content size that is larger thanstd.math.maxInt(usize)
error.DictionaryIdFlagUnsupported
if the frame uses a dictionaryerror.ChecksumFailure
ifverify_checksum
is true and the frame contains a checksum that does not match the checksum of the decompressed dataerror.ReservedBitSet
if any of the reserved bits of the frame header are seterror.EndOfStream
ifsrc
does not contain a complete frameerror.BadContentSize
if the content size declared by the frame does not equal the actual size of decompressed dataerror.OutOfMemory
ifallocator
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 thansrc.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
ifsource
begins with bytes not equal to the Zstandard frame magic number, or outside the range of magic numbers for skippable frames.error.EndOfStream
ifsource
contains fewer than 4 byteserror.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
ifsource
begins with bytes not equal to the Zstandard frame magic number, or outside the range of magic numbers for skippable frames.error.EndOfStream
ifsource
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
intodest
, returning the number of bytes …Decode a Zstandard frame from
src
intodest
, returning the number of bytes read fromsrc
and written todest
. The first four bytes ofsrc
must be the magic number for a Zstandard frame.Error returned:
error.UnknownContentSizeUnsupported
if the frame does not declare the uncompressed content sizeerror.ContentTooLarge
ifdest
is smaller than the uncompressed data size declared by the frame headererror.WindowSizeUnknown
if the frame does not have a valid window sizeerror.DictionaryIdFlagUnsupported
if the frame uses a dictionaryerror.ContentSizeTooLarge
if the frame header indicates a content size that is larger thanstd.math.maxInt(usize)
error.ChecksumFailure
ifverify_checksum
is true and the frame contains a checksum that does not match the checksum of the decompressed dataerror.ReservedBitSet
if the reserved bit of the frame header is seterror.EndOfStream
ifsrc
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; seedecodeZstandardFrame()
. The first four bytes ofsrc
must be the magic number for a Zstandard frame.Errors returned:
error.WindowSizeUnknown
if the frame does not have a valid window sizeerror.WindowTooLarge
if the window size is larger thanwindow_size_max
error.DictionaryIdFlagUnsupported
if the frame uses a dictionaryerror.ContentSizeTooLarge
if the frame header indicates a content size that is larger thanstd.math.maxInt(usize)
error.ChecksumFailure
ifverify_checksum
is true and the frame contains a checksum that does not match the checksum of the decompressed dataerror.ReservedBitSet
if the reserved bit of the frame header is seterror.EndOfStream
ifsrc
does not contain a complete frameerror.OutOfMemory
ifallocator
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 seterror.EndOfStream
ifsource
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
ifmagic
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
ismagic
is a valid magic number for a skippable frame