mirror of
https://github.com/golang/go.git
synced 2025-05-18 13:54:40 +00:00
compress: some minor corrections or adjustments for godoc link
Change-Id: Ic1fc777b9a4e8262851e27646d53a0ec4fe55b64 Reviewed-on: https://go-review.googlesource.com/c/go/+/535076 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
34f2365d88
commit
dc12cb179a
@ -32,7 +32,7 @@ func newBitReader(r io.Reader) bitReader {
|
|||||||
|
|
||||||
// ReadBits64 reads the given number of bits and returns them in the
|
// ReadBits64 reads the given number of bits and returns them in the
|
||||||
// least-significant part of a uint64. In the event of an error, it returns 0
|
// least-significant part of a uint64. In the event of an error, it returns 0
|
||||||
// and the error can be obtained by calling [bitReader.Err]().
|
// and the error can be obtained by calling bitReader.Err().
|
||||||
func (br *bitReader) ReadBits64(bits uint) (n uint64) {
|
func (br *bitReader) ReadBits64(bits uint) (n uint64) {
|
||||||
for bits > br.bits {
|
for bits > br.bits {
|
||||||
b, err := br.r.ReadByte()
|
b, err := br.r.ReadByte()
|
||||||
|
@ -803,7 +803,7 @@ func (f *decompressor) Reset(r io.Reader, dict []byte) error {
|
|||||||
// The reader returns [io.EOF] after the final block in the DEFLATE stream has
|
// The reader returns [io.EOF] after the final block in the DEFLATE stream has
|
||||||
// been encountered. Any trailing data after the final block is ignored.
|
// been encountered. Any trailing data after the final block is ignored.
|
||||||
//
|
//
|
||||||
// The ReadCloser returned by NewReader also implements [Resetter].
|
// The [io.ReadCloser] returned by NewReader also implements [Resetter].
|
||||||
func NewReader(r io.Reader) io.ReadCloser {
|
func NewReader(r io.Reader) io.ReadCloser {
|
||||||
fixedHuffmanDecoderInit()
|
fixedHuffmanDecoderInit()
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ type Reader struct {
|
|||||||
//
|
//
|
||||||
// It is the caller's responsibility to call Close on the [Reader] when done.
|
// It is the caller's responsibility to call Close on the [Reader] when done.
|
||||||
//
|
//
|
||||||
// The Reader.Header fields will be valid in the [Reader] returned.
|
// The [Reader.Header] fields will be valid in the [Reader] returned.
|
||||||
func NewReader(r io.Reader) (*Reader, error) {
|
func NewReader(r io.Reader) (*Reader, error) {
|
||||||
z := new(Reader)
|
z := new(Reader)
|
||||||
if err := z.Reset(r); err != nil {
|
if err := z.Reset(r); err != nil {
|
||||||
|
@ -238,7 +238,7 @@ func (w *Writer) Close() error {
|
|||||||
return w.w.Flush()
|
return w.w.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset clears the[ Writer]'s state and allows it to be reused again
|
// Reset clears the [Writer]'s state and allows it to be reused again
|
||||||
// as a new [Writer].
|
// as a new [Writer].
|
||||||
func (w *Writer) Reset(dst io.Writer, order Order, litWidth int) {
|
func (w *Writer) Reset(dst io.Writer, order Order, litWidth int) {
|
||||||
*w = Writer{}
|
*w = Writer{}
|
||||||
|
@ -70,7 +70,7 @@ type Resetter interface {
|
|||||||
// data than necessary from r.
|
// data than necessary from r.
|
||||||
// It is the caller's responsibility to call Close on the ReadCloser when done.
|
// It is the caller's responsibility to call Close on the ReadCloser when done.
|
||||||
//
|
//
|
||||||
// The ReadCloser returned by NewReader also implements [Resetter].
|
// The [io.ReadCloser] returned by NewReader also implements [Resetter].
|
||||||
func NewReader(r io.Reader) (io.ReadCloser, error) {
|
func NewReader(r io.Reader) (io.ReadCloser, error) {
|
||||||
return NewReaderDict(r, nil)
|
return NewReaderDict(r, nil)
|
||||||
}
|
}
|
||||||
@ -119,9 +119,9 @@ func (z *reader) Read(p []byte) (int, error) {
|
|||||||
return n, io.EOF
|
return n, io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calling Close does not close the wrapped io.Reader originally passed to [NewReader].
|
// 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
|
// In order for the ZLIB checksum to be verified, the reader must be
|
||||||
// fully consumed until the io.EOF.
|
// fully consumed until the [io.EOF].
|
||||||
func (z *reader) Close() error {
|
func (z *reader) Close() error {
|
||||||
if z.err != nil && z.err != io.EOF {
|
if z.err != nil && z.err != io.EOF {
|
||||||
return z.err
|
return z.err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user