compression

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package compression manages compression algorithm implementations.

Index

Constants

This section is empty.

Variables

View Source
var (
	ByHeaderID = map[HeaderID]Compressor{}
	ByName     = map[Name]Compressor{}
)

maps of registered compressors by header ID and name.

Functions

func RegisterCompressor

func RegisterCompressor(name Name, c Compressor)

RegisterCompressor registers the provided compressor implementation.

Types

type Compressor

type Compressor interface {
	HeaderID() HeaderID
	Compress(output *bytes.Buffer, input []byte) error
	Decompress(output *bytes.Buffer, input []byte) error
}

Compressor implements compression and decompression of a byte slice.

type HeaderID

type HeaderID uint32

HeaderID is a unique identifier of the compressor stored in the compressed block header.

func IDFromHeader

func IDFromHeader(b []byte) (HeaderID, error)

IDFromHeader retrieves compression ID from content header.

type Name

type Name string

Name is the name of the compressor to use.

Jump to

Keyboard shortcuts

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