compressor

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringCompressorAlgorithm

func StringCompressorAlgorithm(a CompressorAlgorithm) string

StringCompressorAlgorithm return the string value of algorithm selected

Types

type Compressor

type Compressor struct {
	Algorithm   CompressorAlgorithm
	MinimumSize int
}

Compressor is a simple compressor to work with relative small size of bytes (all is in memory)

func (*Compressor) Compress

func (mc *Compressor) Compress(bs []byte) ([]byte, error)

Compress compress bs input based on Algorithm and return the data compressed

func (*Compressor) StringAlgoritm

func (mc *Compressor) StringAlgoritm() string

StringAlgoritm return the string value of algorithm selected in Compressor object

type CompressorAlgorithm

type CompressorAlgorithm int

CompressorAlgorithm define the compression algorithm used bye Compressor

const (
	// CompressorNoComprs means compression disabled
	CompressorNoComprs CompressorAlgorithm = iota
	// CompressorGzip set GZIP compression
	CompressorGzip
	// CompressorZlib is Deprecated: This is not properly working if more than one message is send by same connection
	CompressorZlib
)

func ParseAlgorithm

func ParseAlgorithm(s string) (CompressorAlgorithm, error)

ParseAlgorithm is the inverse func of StringCompressorAlgorithm. Error is returned if s value is not matching with none valid algorithm

Jump to

Keyboard shortcuts

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