compressor

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	None   Type = "none"
	Snappy      = "snappy"
	Gzip        = "gzip"
	Lzo         = "lzo"
	Zstd        = "zstd"
)

Variables

View Source
var GetExtensionFileByCompressor = map[Type]string{
	None:   "",
	Snappy: ".snappy",
	Gzip:   ".gz",
	Lzo:    ".lzo",
	Zstd:   ".zst",
}

Functions

func IsSupportedCompressor added in v1.0.0

func IsSupportedCompressor(compressor string) bool

Types

type Compressor

type Compressor interface {
	Encode(src []byte) ([]byte, error)
	Decode(str []byte) ([]byte, error)
}

func Get

func Get(c Type) (Compressor, error)

type GzipCompressor

type GzipCompressor struct {
}

func NewGzipCompressor

func NewGzipCompressor() *GzipCompressor

func (*GzipCompressor) Decode

func (c *GzipCompressor) Decode(src []byte) ([]byte, error)

func (*GzipCompressor) Encode

func (c *GzipCompressor) Encode(src []byte) ([]byte, error)

type LzoCompressor

type LzoCompressor struct {
}

func NewLzoCompressor

func NewLzoCompressor() *LzoCompressor

func (*LzoCompressor) Decode

func (c *LzoCompressor) Decode(src []byte) ([]byte, error)

func (*LzoCompressor) Encode

func (c *LzoCompressor) Encode(src []byte) ([]byte, error)

type NoneCompressor

type NoneCompressor struct {
}

NoneCompressor do nothing

func NewNoneCompressor

func NewNoneCompressor() *NoneCompressor

func (*NoneCompressor) Decode

func (c *NoneCompressor) Decode(src []byte) ([]byte, error)

Decode do nothing: output is equal to input

func (*NoneCompressor) Encode

func (c *NoneCompressor) Encode(src []byte) ([]byte, error)

Encode do nothing: output is equal to input

type SnappyCompressor

type SnappyCompressor struct {
}

func NewSnappyCompressor

func NewSnappyCompressor() *SnappyCompressor

func (*SnappyCompressor) Decode

func (c *SnappyCompressor) Decode(src []byte) ([]byte, error)

func (*SnappyCompressor) Encode

func (c *SnappyCompressor) Encode(src []byte) ([]byte, error)

type Type added in v1.0.0

type Type string

func AvailableCompressors added in v1.0.0

func AvailableCompressors() []Type

type ZstdCompressor

type ZstdCompressor struct {
}

func NewZstdCompressor

func NewZstdCompressor() *ZstdCompressor

func (*ZstdCompressor) Decode

func (c *ZstdCompressor) Decode(src []byte) ([]byte, error)

func (*ZstdCompressor) Encode

func (c *ZstdCompressor) Encode(src []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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