package flate

Import Path
	compress/flate (on golang.org and go.dev)

Dependency Relation
	imports 8 packages, and imported by one package

Involved Source Files
	    deflate.go
	    deflatefast.go
	    dict_decoder.go
	    huffman_bit_writer.go
	    huffman_code.go
	d-> inflate.go
	    token.go

Exported Type Names

type CorruptInputError int64 A CorruptInputError reports the presence of corrupt input at a given offset. (T) Error() string T : error
type InternalError string An InternalError reports an error in the flate code itself. (T) Error() string T : error
type Reader (interface) The actual read interface needed by NewReader. If the passed in io.Reader does not also have ReadByte, the NewReader will introduce its own buffering. (T) Read(p []byte) (n int, err error) (T) ReadByte() (byte, error) bufio.(*Reader) bufio.ReadWriter bytes.(*Buffer) bytes.(*Reader) strings.(*Reader) T : io.ByteReader T : io.Reader
type ReadError (struct) A ReadError reports an error encountered while reading input. Deprecated: No longer returned. Err error Offset int64 (*T) Error() string *T : error
type Resetter (interface) Resetter resets a ReadCloser returned by NewReader or NewReaderDict to switch to a new underlying Reader. This permits reusing a ReadCloser instead of allocating a new one. (T) Reset(r io.Reader, dict []byte) error
type WriteError (struct) A WriteError reports an error encountered while writing output. Deprecated: No longer returned. Err error Offset int64 (*T) Error() string *T : error
type Writer (struct) A Writer takes data written to it and writes the compressed form of that data to an underlying writer (see NewWriter). (*T) Close() error (*T) Flush() error (*T) Reset(dst io.Writer) (*T) Write(data []byte) (n int, err error) *T : io.Closer *T : io.WriteCloser *T : io.Writer func NewWriter(w io.Writer, level int) (*Writer, error) func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, error)
Exported Values
const BestCompression = 9
const BestSpeed = 1
const DefaultCompression = -1
const HuffmanOnly = -2 HuffmanOnly disables Lempel-Ziv match searching and only performs Huffman entropy encoding. This mode is useful in compressing data that has already been compressed with an LZ style algorithm (e.g. Snappy or LZ4) that lacks an entropy encoder. Compression gains are achieved when certain bytes in the input stream occur more frequently than others. Note that HuffmanOnly produces a compressed output that is RFC 1951 compliant. That is, any valid DEFLATE decompressor will continue to be able to decompress this output.
func NewReader(r io.Reader) io.ReadCloser NewReader returns a new ReadCloser that can be used to read the uncompressed version of r. If r does not also implement io.ByteReader, the decompressor may read more data than necessary from r. It is the caller's responsibility to call Close on the ReadCloser when finished reading. The ReadCloser returned by NewReader also implements Resetter.
func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser NewReaderDict is like NewReader but initializes the reader with a preset dictionary. The returned Reader behaves as if the uncompressed data stream started with the given dictionary, which has already been read. NewReaderDict is typically used to read data compressed by NewWriterDict. The ReadCloser returned by NewReader also implements Resetter.
func NewWriter(w io.Writer, level int) (*Writer, error) NewWriter returns a new Writer compressing data at the given level. Following zlib, levels range from 1 (BestSpeed) to 9 (BestCompression); higher levels typically run slower but compress more. Level 0 (NoCompression) does not attempt any compression; it only adds the necessary DEFLATE framing. Level -1 (DefaultCompression) uses the default compression level. Level -2 (HuffmanOnly) will use Huffman compression only, giving a very fast compression for all types of input, but sacrificing considerable compression efficiency. If level is in the range [-2, 9] then the error returned will be nil. Otherwise the error returned will be non-nil.
func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, error) NewWriterDict is like NewWriter but initializes the new Writer with a preset dictionary. The returned Writer behaves as if the dictionary had been written to it without producing any compressed output. The compressed data written to w can only be decompressed by a Reader initialized with the same dictionary.
const NoCompression = 0