lz4stream

package
v4.1.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package lz4stream provides the types that support reading and writing LZ4 data streams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocks

type Blocks struct {
	Block  *FrameDataBlock
	Blocks chan chan *FrameDataBlock
	// contains filtered or unexported fields
}

func (*Blocks) ErrorR added in v4.1.1

func (b *Blocks) ErrorR() error

ErrorR returns any error set while uncompressing a stream.

type DataBlockSize

type DataBlockSize uint32

DataBlockSize is defined as follow:

field         bits
-----         ----
size          31
Uncompressed  1

func (DataBlockSize) Uncompressed

func (x DataBlockSize) Uncompressed() bool

func (*DataBlockSize) UncompressedSet

func (x *DataBlockSize) UncompressedSet(v bool) *DataBlockSize

type DescriptorFlags

type DescriptorFlags uint16

DescriptorFlags is defined as follow:

field              bits
-----              ----
_                  2
ContentChecksum    1
Size               1
BlockChecksum      1
BlockIndependence  1
Version            2
_                  4
BlockSizeIndex     3
_                  1

func (DescriptorFlags) BlockChecksum

func (x DescriptorFlags) BlockChecksum() bool

func (*DescriptorFlags) BlockChecksumSet

func (x *DescriptorFlags) BlockChecksumSet(v bool) *DescriptorFlags

func (DescriptorFlags) BlockIndependence

func (x DescriptorFlags) BlockIndependence() bool

func (*DescriptorFlags) BlockIndependenceSet

func (x *DescriptorFlags) BlockIndependenceSet(v bool) *DescriptorFlags

func (DescriptorFlags) BlockSizeIndex

func (x DescriptorFlags) BlockSizeIndex() lz4block.BlockSizeIndex

func (*DescriptorFlags) BlockSizeIndexSet

func (x *DescriptorFlags) BlockSizeIndexSet(v lz4block.BlockSizeIndex) *DescriptorFlags

func (DescriptorFlags) ContentChecksum

func (x DescriptorFlags) ContentChecksum() bool

Getters.

func (*DescriptorFlags) ContentChecksumSet

func (x *DescriptorFlags) ContentChecksumSet(v bool) *DescriptorFlags

Setters.

func (DescriptorFlags) Size

func (x DescriptorFlags) Size() bool

func (*DescriptorFlags) SizeSet

func (x *DescriptorFlags) SizeSet(v bool) *DescriptorFlags

func (DescriptorFlags) Version

func (x DescriptorFlags) Version() uint16

func (*DescriptorFlags) VersionSet

func (x *DescriptorFlags) VersionSet(v uint16) *DescriptorFlags

type Frame

type Frame struct {
	Magic      uint32
	Descriptor FrameDescriptor
	Blocks     Blocks
	Checksum   uint32
	// contains filtered or unexported fields
}

func NewFrame

func NewFrame() *Frame

func (*Frame) CloseR

func (f *Frame) CloseR(src io.Reader) (err error)

func (*Frame) CloseW

func (f *Frame) CloseW(dst io.Writer, num int) error

func (*Frame) InitR

func (f *Frame) InitR(src io.Reader, num int) (chan []byte, error)

func (*Frame) InitW

func (f *Frame) InitW(dst io.Writer, num int, legacy bool)

func (*Frame) ParseHeaders added in v4.1.5

func (f *Frame) ParseHeaders(src io.Reader) error

func (*Frame) Reset

func (f *Frame) Reset(num int)

Reset allows reusing the Frame. The Descriptor configuration is not modified.

type FrameDataBlock

type FrameDataBlock struct {
	Size     DataBlockSize
	Data     []byte // compressed or uncompressed data (.data or .src)
	Checksum uint32
	// contains filtered or unexported fields
}

func NewFrameDataBlock

func NewFrameDataBlock(f *Frame) *FrameDataBlock

func (*FrameDataBlock) Close added in v4.1.1

func (b *FrameDataBlock) Close(f *Frame)

func (*FrameDataBlock) Compress

func (b *FrameDataBlock) Compress(f *Frame, src []byte, level lz4block.CompressionLevel) *FrameDataBlock

Block compression errors are ignored since the buffer is sized appropriately.

func (*FrameDataBlock) Read added in v4.1.1

func (b *FrameDataBlock) Read(f *Frame, src io.Reader, cum uint32) (uint32, error)

Read updates b with the next block data, size and checksum if available.

func (*FrameDataBlock) Uncompress

func (b *FrameDataBlock) Uncompress(f *Frame, dst, dict []byte, sum bool) ([]byte, error)

func (*FrameDataBlock) Write

func (b *FrameDataBlock) Write(f *Frame, dst io.Writer) error

type FrameDescriptor

type FrameDescriptor struct {
	Flags       DescriptorFlags
	ContentSize uint64
	Checksum    uint8
}

func (*FrameDescriptor) Write

func (fd *FrameDescriptor) Write(f *Frame, dst io.Writer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL