compress

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package compress implements compression support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatU128 added in v0.5.0

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 added in v0.5.0

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

CorruptedDataErr means that provided hash mismatch with calculated.

func (*CorruptedDataErr) Error added in v0.5.0

func (c *CorruptedDataErr) Error() string

type Method

type Method byte

Method is compression codec.

const (
	None Method = 0x02
	LZ4  Method = 0x82
	ZSTD Method = 0x90
)

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 (*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