compress

package
v0.0.0-...-d5b5c0c Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: AGPL-3.0 Imports: 2 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 {
	Reset(to io.Writer)
	Write([]byte) (int, error)
	Flush() error
	Close() error
}

Compressor implements a simple common interface across compressors. Note that some compressors require a call to Close to finalize the stream. They should have a wrapper type implemented in Flush.

type Counter

type Counter interface{ Count() int64 }

type LZ4

type LZ4 struct {
	*lz4.Writer

	Level
	// contains filtered or unexported fields
}

LZ4 is a wrapper for lz4.Writer which knows how to Flush properly.

func (*LZ4) Close

func (l *LZ4) Close() error

func (*LZ4) Count

func (l *LZ4) Count() int64

func (*LZ4) Flush

func (l *LZ4) Flush() error

Flush flushes and finalizes the LZ4 block stream.

func (*LZ4) Reset

func (l *LZ4) Reset(w io.Writer)

type LZ4Maker

type LZ4Maker struct{ Level }

func (LZ4Maker) Make

func (l LZ4Maker) Make() Compressor

type Level

type Level int

Level is a mapping for compression levels. Each Compressor may have its own way of mapping Level constants to internal values. User- facing code should select a Level from among the defined constants.

const (
	Fastest Level = iota
	Medium
	High

	// LZ4-specific.
	LZ4HC
)

Level constants. To maintain backwards compatibility, new constants must be added at the end of the list.

func (Level) String

func (l Level) String() string

Implement fmt.Stringer for fmt-compatible output strings.

type Maker

type Maker interface {
	Make() Compressor
}

type NoCompress

type NoCompress struct{ io.Writer }

NoCompress is a noop Compressor.

func (NoCompress) Close

func (NoCompress) Close() error

Flush implements Compressor on NoCompress.

func (NoCompress) Flush

func (NoCompress) Flush() error

func (*NoCompress) Reset

func (n *NoCompress) Reset(to io.Writer)

Reset implements Compressor on NoCompress.

type NoMaker

type NoMaker struct{}

func (NoMaker) Make

func (NoMaker) Make() Compressor

type WCounter

type WCounter struct {
	Written int64
	io.Writer
}

func (*WCounter) Count

func (c *WCounter) Count() int64

func (*WCounter) ReadFrom

func (c *WCounter) ReadFrom(some io.Reader) (n int64, err error)

func (*WCounter) Write

func (c *WCounter) Write(some []byte) (n int, err error)

Jump to

Keyboard shortcuts

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