Versions in this module Expand all Collapse all v0 v0.0.2 Nov 6, 2023 Changes in this version + const ChunkTypeIndex + const MaxBlockSize + const MaxDictSize + const MaxDictSrcOffset + const MinDictSize + const S2IndexHeader + const S2IndexTrailer + var ErrCRC = errors.New("s2: corrupt input, crc mismatch") + var ErrCorrupt = errors.New("s2: corrupt input") + var ErrDstTooSmall = errors.New("s2: destination too small") + var ErrTooLarge = errors.New("s2: decoded block is too large") + var ErrUnsupported = errors.New("s2: unsupported input") + func ConcatBlocks(dst []byte, blocks ...[]byte) ([]byte, error) + func Decode(dst, src []byte) ([]byte, error) + func DecodedLen(src []byte) (int, error) + func Encode(dst, src []byte) []byte + func EncodeBest(dst, src []byte) []byte + func EncodeBetter(dst, src []byte) []byte + func EncodeSnappy(dst, src []byte) []byte + func EncodeSnappyBest(dst, src []byte) []byte + func EncodeSnappyBetter(dst, src []byte) []byte + func EstimateBlockSize(src []byte) (d int) + func IndexStream(r io.Reader) ([]byte, error) + func MaxEncodedLen(srcLen int) int + func RemoveIndexHeaders(b []byte) []byte + func RestoreIndexHeaders(in []byte) []byte + type Dict struct + func MakeDict(data []byte, searchStart []byte) *Dict + func MakeDictManual(data []byte, firstIdx uint16) *Dict + func NewDict(dict []byte) *Dict + func (d *Dict) Bytes() []byte + func (d *Dict) Decode(dst, src []byte) ([]byte, error) + func (d *Dict) Encode(dst, src []byte) []byte + func (d *Dict) EncodeBest(dst, src []byte) []byte + func (d *Dict) EncodeBetter(dst, src []byte) []byte + type ErrCantSeek struct + Reason string + func (e ErrCantSeek) Error() string + type Index struct + TotalCompressed int64 + TotalUncompressed int64 + func (i *Index) Find(offset int64) (compressedOff, uncompressedOff int64, err error) + func (i *Index) JSON() []byte + func (i *Index) Load(b []byte) ([]byte, error) + func (i *Index) LoadStream(rs io.ReadSeeker) error + type LZ4Converter struct + func (l *LZ4Converter) ConvertBlock(dst, src []byte) ([]byte, int, error) + func (l *LZ4Converter) ConvertBlockSnappy(dst, src []byte) ([]byte, int, error) + type LZ4sConverter struct + func (l *LZ4sConverter) ConvertBlock(dst, src []byte) ([]byte, int, error) + func (l *LZ4sConverter) ConvertBlockSnappy(dst, src []byte) ([]byte, int, error) + type ReadSeeker struct + func (r *ReadSeeker) ReadAt(p []byte, offset int64) (int, error) + func (r *ReadSeeker) Seek(offset int64, whence int) (int64, error) + type Reader struct + func NewReader(r io.Reader, opts ...ReaderOption) *Reader + func (r *Reader) DecodeConcurrent(w io.Writer, concurrent int) (written int64, err error) + func (r *Reader) GetBufferCapacity() int + func (r *Reader) Read(p []byte) (int, error) + func (r *Reader) ReadByte() (byte, error) + func (r *Reader) ReadSeeker(random bool, index []byte) (*ReadSeeker, error) + func (r *Reader) Reset(reader io.Reader) + func (r *Reader) Skip(n int64) error + func (r *Reader) SkippableCB(id uint8, fn func(r io.Reader) error) error + type ReaderOption func(*Reader) error + func ReaderAllocBlock(blockSize int) ReaderOption + func ReaderIgnoreCRC() ReaderOption + func ReaderIgnoreStreamIdentifier() ReaderOption + func ReaderMaxBlockSize(blockSize int) ReaderOption + func ReaderSkippableCB(id uint8, fn func(r io.Reader) error) ReaderOption + type Writer struct + func NewWriter(w io.Writer, opts ...WriterOption) *Writer + func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) + func (w *Writer) Close() error + func (w *Writer) CloseIndex() ([]byte, error) + func (w *Writer) EncodeBuffer(buf []byte) (err error) + func (w *Writer) Flush() error + func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) + func (w *Writer) Reset(writer io.Writer) + func (w *Writer) Write(p []byte) (nRet int, errRet error) + type WriterOption func(*Writer) error + func WriterAddIndex() WriterOption + func WriterBestCompression() WriterOption + func WriterBetterCompression() WriterOption + func WriterBlockSize(n int) WriterOption + func WriterConcurrency(n int) WriterOption + func WriterCustomEncoder(fn func(dst, src []byte) int) WriterOption + func WriterFlushOnWrite() WriterOption + func WriterPadding(n int) WriterOption + func WriterPaddingSrc(reader io.Reader) WriterOption + func WriterSnappyCompat() WriterOption + func WriterUncompressed() WriterOption