compress

package
v0.63.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 14

Documentation

Overview

Package compress implements compression support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatU128

func FormatU128(v city.U128) string

FormatU128 formats city.U128 as hex.

func MethodStrings

func MethodStrings() []string

MethodStrings returns a slice of all String values of the enum

Types

type CorruptedDataErr

type CorruptedDataErr struct {
	Actual    city.U128
	Reference city.U128
	RawSize   int
	DataSize  int
}

CorruptedDataErr means that provided hash mismatch with calculated.

func (*CorruptedDataErr) Error

func (c *CorruptedDataErr) Error() string

type Level added in v0.62.0

type Level uint32

Level for supporting compression codecs.

const (
	CompressionLevelLZ4HCDefault Level = 9
	CompressionLevelLZ4HCMax     Level = 12
)

type Method

type Method byte

Method is compression codec.

const (
	None Method = iota
	LZ4
	LZ4HC
	ZSTD
)

Possible compression methods.

func MethodString

func MethodString(s string) (Method, error)

MethodString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func MethodValues

func MethodValues() []Method

MethodValues returns all values of the enum

func (Method) IsAMethod

func (i Method) IsAMethod() bool

IsAMethod returns "true" if the value is listed in the enum definition. "false" otherwise

func (Method) String

func (i Method) String() string

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader decodes compressed blocks.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns new *Reader from r.

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

Read implements io.Reader.

type Writer

type Writer struct {
	Data []byte
	// contains filtered or unexported fields
}

Writer encodes compressed blocks.

func NewWriter

func NewWriter() *Writer

func NewWriterWithLevel added in v0.62.0

func NewWriterWithLevel(l Level) *Writer

func (*Writer) Compress

func (w *Writer) Compress(m Method, buf []byte) error

Compress buf into Data.

Jump to

Keyboard shortcuts

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