compr

package
v0.0.0-...-86e9f11 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package compr provides a unified interface wrapping third-party compression libraries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeZstd

func DecodeZstd(src, dst []byte) ([]byte, error)

DecodeZstd calls DecodeAll on the global zstd decoder.

See: (*zstd.Decoder).DecodeAll

Types

type Compressor

type Compressor interface {
	// Name is the name of the compression algorithm.
	Name() string
	// Compress should append the compressed contents
	// of src to dst and return the result.
	Compress(src, dst []byte) []byte
}

Compressor describes the interface that CompressionWriter needs a compression algorithm to implement.

func Compression

func Compression(name string) Compressor

Compression selects a compression algorithm by name. The returned Compressor will return the same value for Compressor.Name as the specified name.

type Decompressor

type Decompressor interface {
	// Name is the name of the compression algorithm.
	// See also Compressor.Name.
	Name() string
	// Decompress decompresses source data
	// into dst. It should error out if
	// dst is not large enough to fit the
	// encoded source data.
	//
	// It must be safe to make multiple
	// calls to Decompress simultaneously
	// from different goroutines.
	Decompress(src, dst []byte) error
}

Decompressor is the interface that a CompressionReader uses to decompress blocks.

func Decompression

func Decompression(name string) Decompressor

Jump to

Keyboard shortcuts

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