native

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Zlib Imports: 4 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 struct {
	// contains filtered or unexported fields
}

Compressor using an underlying C zlib stream to compress (deflate) data

func NewCompressor

func NewCompressor(lvl int) (*Compressor, error)

NewCompressor returns and initializes a new Compressor with zlib compression stream initialized

func NewCompressorStrategy

func NewCompressorStrategy(lvl, strat int) (*Compressor, error)

NewCompressorStrategy returns and initializes a new Compressor with given level and strategy with zlib compression stream initialized

func (*Compressor) Close

func (c *Compressor) Close() ([]byte, error)

Close closes the underlying zlib stream and frees the allocated memory

func (*Compressor) Compress

func (c *Compressor) Compress(in, out []byte) ([]byte, error)

Compress compresses the given data and returns it as byte slice

func (*Compressor) CompressStream added in v1.1.0

func (c *Compressor) CompressStream(in []byte) ([]byte, error)

func (*Compressor) Flush added in v1.1.0

func (c *Compressor) Flush() ([]byte, error)

func (*Compressor) IsClosed

func (c *Compressor) IsClosed() bool

IsClosed returns whether the StreamCloser has closed the underlying stream

func (*Compressor) Reset added in v1.1.0

func (c *Compressor) Reset() ([]byte, error)

type Decompressor

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

Decompressor using an underlying c zlib stream to decompress (inflate) data

func NewDecompressor

func NewDecompressor() (*Decompressor, error)

NewDecompressor returns and initializes a new Decompressor with zlib compression stream initialized

func (*Decompressor) Close

func (c *Decompressor) Close() error

Close closes the underlying zlib stream and frees the allocated memory

func (*Decompressor) Decompress

func (c *Decompressor) Decompress(in, out []byte) (int, []byte, error)

Decompress decompresses the given data and returns it as byte slice (preferably in one go)

func (*Decompressor) DecompressStream added in v1.1.0

func (c *Decompressor) DecompressStream(in, out []byte) (bool, int, []byte, error)

func (*Decompressor) IsClosed

func (c *Decompressor) IsClosed() bool

IsClosed returns whether the StreamCloser has closed the underlying stream

func (*Decompressor) Reset added in v1.1.0

func (c *Decompressor) Reset() error

type StreamCloser

type StreamCloser interface {
	// IsClosed returns whether the StreamCloser has closed the underlying stream
	IsClosed() bool
}

StreamCloser can indicate whether their underlying stream is closed. If so, the StreamCloser must not be used anymore

Jump to

Keyboard shortcuts

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