package fse
Import Path
github.com/klauspost/compress/fse (on go.dev)
Dependency Relation
imports 5 packages, and imported by one package
Involved Source Files
bitreader.go
bitwriter.go
bytereader.go
compress.go
decompress.go
Package fse provides Finite State Entropy encoding and decoding.
Finite State Entropy encoding provides a fast near-optimal symbol encoding/decoding
for byte blocks as implemented in zstd.
See https://github.com/klauspost/compress/tree/master/fse for more information.
Package-Level Type Names (only one)
Scratch provides temporary storage for compression and decompression.
DecompressLimit limits the maximum decoded size acceptable.
If > 0 decompression will stop when approximately this many bytes
has been decoded.
If 0, maximum size will be 2GB.
MaxSymbolValue will override the maximum symbol value of the next block.
Out is output buffer.
If the scratch is re-used before the caller is done processing the output,
set this field to nil.
Otherwise the output buffer will be re-used for next Compression/Decompression step
and allocation will be avoided.
TableLog will attempt to override the tablelog for the next block.
Histogram allows to populate the histogram and skip that step in the compression,
It otherwise allows to inspect the histogram when compression is done.
To indicate that you have populated the histogram call HistogramFinished
with the value of the highest populated symbol, as well as the number of entries
in the most populated entry. These are accepted at face value.
The returned slice will always be length 256.
HistogramFinished can be called to indicate that the histogram has been populated.
maxSymbol is the index of the highest set symbol of the next data segment.
maxCount is the number of entries in the most populated entry.
These are accepted at face value.
func Compress(in []byte, s *Scratch) ([]byte, error)
func Decompress(b []byte, s *Scratch) ([]byte, error)
Package-Level Functions (total 2)
Compress the input bytes. Input must be < 2GB.
Provide a Scratch buffer to avoid memory allocations.
Note that the output is also kept in the scratch buffer.
If input is too hard to compress, ErrIncompressible is returned.
If input is a single byte value repeated ErrUseRLE is returned.
Decompress a block of data.
You can provide a scratch buffer to avoid allocations.
If nil is provided a temporary one will be allocated.
It is possible, but by no way guaranteed that corrupt data will
return an error.
It is up to the caller to verify integrity of the returned data.
Use a predefined Scratch to set maximum acceptable output size.
Package-Level Variables (total 2)
ErrIncompressible is returned when input is judged to be too hard to compress.
ErrUseRLE is returned from the compressor when the input is a single byte value repeated.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |