compressor

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	CompressBytes(src, dest []byte) ([]byte, error)
	UncompressBytes(src, dest []byte) ([]byte, error)
	CompressorID() wiremessage.CompressorID
	Name() string
}

Compressor is the interface implemented by types that can compress and decompress wire messages. This is used when sending and receiving messages to and from the server.

func CreateSnappy

func CreateSnappy() Compressor

CreateSnappy creates a snappy compressor

func CreateZlib

func CreateZlib(level int) (Compressor, error)

CreateZlib creates a zlib compressor

type SnappyCompressor

type SnappyCompressor struct {
}

SnappyCompressor uses the snappy method to compress data

func (*SnappyCompressor) CompressBytes

func (s *SnappyCompressor) CompressBytes(src, dest []byte) ([]byte, error)

CompressBytes uses snappy to compress a slice of bytes.

func (*SnappyCompressor) CompressorID

func (s *SnappyCompressor) CompressorID() wiremessage.CompressorID

CompressorID returns the ID for the snappy compressor.

func (*SnappyCompressor) Name

func (s *SnappyCompressor) Name() string

Name returns the string name for the snappy compressor.

func (*SnappyCompressor) UncompressBytes

func (s *SnappyCompressor) UncompressBytes(src, dest []byte) ([]byte, error)

UncompressBytes uses snappy to uncompress a slice of bytes.

type ZlibCompressor

type ZlibCompressor struct {
	// contains filtered or unexported fields
}

ZlibCompressor uses the zlib method to compress data

func (*ZlibCompressor) CompressBytes

func (z *ZlibCompressor) CompressBytes(src, dest []byte) ([]byte, error)

CompressBytes uses zlib to compress a slice of bytes.

func (*ZlibCompressor) CompressorID

func (z *ZlibCompressor) CompressorID() wiremessage.CompressorID

CompressorID returns the ID for the zlib compressor.

func (*ZlibCompressor) Name

func (z *ZlibCompressor) Name() string

Name returns the name for the zlib compressor.

func (*ZlibCompressor) UncompressBytes

func (z *ZlibCompressor) UncompressBytes(src, dest []byte) ([]byte, error)

UncompressBytes uses zlib to uncompress a slice of bytes. It assumes dest is empty and is the exact size that it needs to be.

Jump to

Keyboard shortcuts

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