Documentation ¶
Index ¶
- Variables
- func Algorithms() []string
- func Decode(algo string, encoded []byte, opts ...DecoderOption) ([]byte, error)
- func Encode(algo string, v []byte, opts ...EncoderOption) ([]byte, error)
- func Register(name string, algorithm Algorithm)
- type Algorithm
- type Decoder
- type DecoderOption
- type Encoder
- type EncoderOption
- type Endian
- type Level
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnsupportedOption unsupported option ErrUnsupportedOption = errors.New("unsupported option") )
Functions ¶
func Decode ¶
func Decode(algo string, encoded []byte, opts ...DecoderOption) ([]byte, error)
Decode method.
Types ¶
type Algorithm ¶
type Algorithm interface { NewEncoder(w io.Writer, opts ...EncoderOption) (Encoder, error) NewDecoder(r io.Reader, opts ...DecoderOption) (Decoder, error) }
Algorithm interface.
type Decoder ¶
type Decoder interface { Read(v []byte) (int, error) Close() error SetOrder(o int) error SetLitWidth(w int) error }
Decoder interface.
func NewDecoder ¶
NewDecoder variadic constructor.
type Encoder ¶
type Encoder interface { Write(v []byte) (int, error) Close() error SetEndian(endian Endian) error SetLitWidth(width int) error SetLevel(level Level) error }
Encoder interface.
func NewEncoder ¶
NewEncoder variadic constructor.
type EncoderOption ¶
EncoderOption variadic function.
func WithEndian ¶ added in v1.1.0
func WithEndian(endian Endian) EncoderOption
WithEndian either MSB (most significant byte) or LSB (least significant byte). Supported by lzw.
func WithLevel ¶ added in v1.1.0
func WithLevel(level Level) EncoderOption
WithLevel compression level. Supported by gzip, zlib.
func WithLitWidth ¶ added in v1.1.0
func WithLitWidth(width int) EncoderOption
WithLitWidth the number of bit's to use for literal codes. Supported by lzw.
type Endian ¶ added in v1.1.0
type Endian int
Endian the order in which bytes are arranged into larger values.
Click to show internal directories.
Click to hide internal directories.