compressor

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bzip2 added in v1.1.0

type Bzip2 struct {
}

func (*Bzip2) Compress added in v1.1.0

func (g *Bzip2) Compress(b []byte) ([]byte, error)

Compress Bzip2 compress

func (*Bzip2) Decompress added in v1.1.0

func (g *Bzip2) Decompress(in []byte) ([]byte, error)

Decompress Bzip2 decompress

func (*Bzip2) GetCompressorType added in v1.1.0

func (g *Bzip2) GetCompressorType() CompressorType

type Compressor

type Compressor interface {
	Compress([]byte) ([]byte, error)
	Decompress([]byte) ([]byte, error)
	GetCompressorType() CompressorType
}

type CompressorType

type CompressorType int8
const (
	CompressorNone CompressorType = iota
	CompressorGzip
	CompressorZip
	CompressorSevenz
	CompressorBzip2
	CompressorLz4
	CompressorDeflate
	CompressorZstd
)

func GetByName added in v1.2.0

func GetByName(name string) CompressorType

func (CompressorType) GetCompressor added in v1.2.0

func (c CompressorType) GetCompressor() Compressor

func (CompressorType) String added in v1.2.0

func (c CompressorType) String() string

type DeflateCompress

type DeflateCompress struct{}

func (*DeflateCompress) Compress

func (*DeflateCompress) Compress(data []byte) ([]byte, error)

func (*DeflateCompress) Decompress

func (*DeflateCompress) Decompress(data []byte) ([]byte, error)

func (*DeflateCompress) GetCompressorType

func (*DeflateCompress) GetCompressorType() CompressorType

type Gzip

type Gzip struct {
}

func (*Gzip) Compress

func (g *Gzip) Compress(b []byte) ([]byte, error)

Compress gzip compress

func (*Gzip) Decompress

func (g *Gzip) Decompress(in []byte) ([]byte, error)

Decompress gzip decompress

func (*Gzip) GetCompressorType

func (g *Gzip) GetCompressorType() CompressorType

type Lz4

type Lz4 struct {
}

func (*Lz4) Compress

func (l *Lz4) Compress(data []byte) ([]byte, error)

func (*Lz4) Decompress

func (l *Lz4) Decompress(in []byte) ([]byte, error)

func (*Lz4) GetCompressorType

func (l *Lz4) GetCompressorType() CompressorType

type NoneCompressor added in v1.2.0

type NoneCompressor struct {
}

func (*NoneCompressor) Compress added in v1.2.0

func (n *NoneCompressor) Compress(data []byte) ([]byte, error)

func (*NoneCompressor) Decompress added in v1.2.0

func (n *NoneCompressor) Decompress(data []byte) ([]byte, error)

func (*NoneCompressor) GetCompressorType added in v1.2.0

func (n *NoneCompressor) GetCompressorType() CompressorType

type Zip

type Zip struct{}

func (Zip) Compress

func (z Zip) Compress(data []byte) ([]byte, error)

func (Zip) Decompress

func (z Zip) Decompress(data []byte) ([]byte, error)

func (Zip) GetCompressorType

func (z Zip) GetCompressorType() CompressorType

type Zstd

type Zstd struct{}

func (Zstd) Compress

func (z Zstd) Compress(data []byte) ([]byte, error)

func (Zstd) Decompress

func (z Zstd) Decompress(data []byte) ([]byte, error)

func (Zstd) GetCompressorType

func (z Zstd) GetCompressorType() CompressorType

Jump to

Keyboard shortcuts

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