zlib

package
v0.0.0-...-4a8f785 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package zlib implements the encoded.Codec interface to apply zlib compression to blobs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

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

A Codec implements the encoded.Codec interface to provide zlib compression of blob data. A zero value is ready for use, but performs no compression. For most uses prefer NewCodec.

func NewCodec

func NewCodec(level Level) Codec

NewCodec returns a Codec using the specified compression level. Note that a zero level means no compression, not default compression.

func (Codec) Decode

func (c Codec) Decode(w io.Writer, src []byte) error

Decode decompresses src via zlib and writes it to w.

func (Codec) DecodedLen

func (c Codec) DecodedLen(src []byte) (int, error)

DecodedLen reports the decoded length of src.

func (Codec) Encode

func (c Codec) Encode(w io.Writer, src []byte) error

Encode compresses src via zlib and writes it to w.

type Level

type Level int

Level determines the compression level to use.

const (
	LevelNone     Level = flate.NoCompression
	LevelFastest  Level = flate.BestSpeed
	LevelSmallest Level = flate.BestCompression
	LevelDefault  Level = flate.DefaultCompression
)

Compression level constants forwarded from compress/flate.

Jump to

Keyboard shortcuts

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