const zlibDeflate … const zlibMaxWindow … var ErrChecksum … var ErrDictionary … var ErrHeader … type reader … type Resetter … // NewReader creates a new ReadCloser. // Reads from the returned ReadCloser read and decompress data from r. // If r does not 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 done. // // The [io.ReadCloser] returned by NewReader also implements [Resetter]. func NewReader(r io.Reader) (io.ReadCloser, error) { … } // NewReaderDict is like [NewReader] but uses a preset dictionary. // NewReaderDict ignores the dictionary if the compressed data does not refer to it. // If the compressed data refers to a different dictionary, NewReaderDict returns [ErrDictionary]. // // The ReadCloser returned by NewReaderDict also implements [Resetter]. func NewReaderDict(r io.Reader, dict []byte) (io.ReadCloser, error) { … } func (z *reader) Read(p []byte) (int, error) { … } // Calling Close does not close the wrapped [io.Reader] originally passed to [NewReader]. // In order for the ZLIB checksum to be verified, the reader must be // fully consumed until the [io.EOF]. func (z *reader) Close() error { … } func (z *reader) Reset(r io.Reader, dict []byte) error { … }