type Order … const LSB … const MSB … const maxWidth … const decoderInvalidCode … const flushBuffer … type Reader … // readLSB returns the next code for "Least Significant Bits first" data. func (r *Reader) readLSB() (uint16, error) { … } // readMSB returns the next code for "Most Significant Bits first" data. func (r *Reader) readMSB() (uint16, error) { … } // Read implements io.Reader, reading uncompressed bytes from its underlying [Reader]. func (r *Reader) Read(b []byte) (int, error) { … } // decode decompresses bytes from r and leaves them in d.toRead. // read specifies how to decode bytes into codes. // litWidth is the width in bits of literal codes. func (r *Reader) decode() { … } var errClosed … // Close closes the [Reader] and returns an error for any future read operation. // It does not close the underlying [io.Reader]. func (r *Reader) Close() error { … } // Reset clears the [Reader]'s state and allows it to be reused again // as a new [Reader]. func (r *Reader) Reset(src io.Reader, order Order, litWidth int) { … } // NewReader creates a new [io.ReadCloser]. // Reads from the returned [io.ReadCloser] read and decompress data from 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 number of bits to use for literal codes, litWidth, must be in the // range [2,8] and is typically 8. It must equal the litWidth // used during compression. // // It is guaranteed that the underlying type of the returned [io.ReadCloser] // is a *[Reader]. func NewReader(r io.Reader, order Order, litWidth int) io.ReadCloser { … } func newReader(src io.Reader, order Order, litWidth int) *Reader { … } func (r *Reader) init(src io.Reader, order Order, litWidth int) { … }