compressor

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 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

type Bzip2 struct {
}

func (*Bzip2) Compress

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

Compress Bzip2 compress

func (*Bzip2) Decompress

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

Decompress Bzip2 decompress

func (*Bzip2) GetCompressorType

func (g *Bzip2) GetCompressorType() CompressorType

type Compressor

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

type CompressorType

type CompressorType string
const (
	// "None" means no compressor is used
	CompressorNone    CompressorType = "None"
	CompressorGzip    CompressorType = "Gzip"
	CompressorZip     CompressorType = "Zip"
	CompressorSevenz  CompressorType = "Sevenz"
	CompressorBzip2   CompressorType = "Bzip2"
	CompressorLz4     CompressorType = "Lz4"
	CompressorDeflate CompressorType = "Deflate"
	CompressorZstd    CompressorType = "Zstd"
)

func (CompressorType) GetCompressor

func (c CompressorType) GetCompressor() Compressor

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

type NoneCompressor struct {
}

func (*NoneCompressor) Compress

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

func (*NoneCompressor) Decompress

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

func (*NoneCompressor) GetCompressorType

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