Commit cabdb853 authored by Billie Harold Cleek's avatar Billie Harold Cleek Committed by Andrew Gerrand

doc: edit documentation that uses "satisfies reads" and "satisfies writes"

Make it clear that types that wrap another reader or writer delegate to the wrapped type.

Fixes #7667

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/85720044
parent fe49aa55
...@@ -22,8 +22,8 @@ const ( ...@@ -22,8 +22,8 @@ const (
DefaultCompression = flate.DefaultCompression DefaultCompression = flate.DefaultCompression
) )
// A Writer is an io.WriteCloser that satisfies writes by compressing data written // A Writer is an io.WriteCloser.
// to its wrapped io.Writer. // Writes to a Writer are compressed and written to w.
type Writer struct { type Writer struct {
Header Header
w io.Writer w io.Writer
...@@ -37,8 +37,8 @@ type Writer struct { ...@@ -37,8 +37,8 @@ type Writer struct {
err error err error
} }
// NewWriter creates a new Writer that satisfies writes by compressing data // NewWriter returns a new Writer.
// written to w. // Writes to the returned writer are compressed and written to w.
// //
// It is the caller's responsibility to call Close on the WriteCloser when done. // It is the caller's responsibility to call Close on the WriteCloser when done.
// Writes may be buffered and not flushed until Close. // Writes may be buffered and not flushed until Close.
......
...@@ -216,8 +216,8 @@ func (d *decoder) Close() error { ...@@ -216,8 +216,8 @@ func (d *decoder) Close() error {
return nil return nil
} }
// NewReader creates a new io.ReadCloser that satisfies reads by decompressing // NewReader creates a new io.ReadCloser.
// the data read from r. // Reads from the returned io.ReadCloser read and decompress data from r.
// It is the caller's responsibility to call Close on the ReadCloser when // It is the caller's responsibility to call Close on the ReadCloser when
// finished reading. // finished reading.
// The number of bits to use for literal codes, litWidth, must be in the // The number of bits to use for literal codes, litWidth, must be in the
......
...@@ -225,8 +225,8 @@ func (e *encoder) Close() error { ...@@ -225,8 +225,8 @@ func (e *encoder) Close() error {
return e.w.Flush() return e.w.Flush()
} }
// NewWriter creates a new io.WriteCloser that satisfies writes by compressing // NewWriter creates a new io.WriteCloser.
// the data and writing it to w. // Writes to the returned io.WriteCloser are compressed and written to w.
// It is the caller's responsibility to call Close on the WriteCloser when // It is the caller's responsibility to call Close on the WriteCloser when
// finished writing. // finished writing.
// The number of bits to use for literal codes, litWidth, must be in the // The number of bits to use for literal codes, litWidth, must be in the
......
...@@ -51,7 +51,8 @@ type reader struct { ...@@ -51,7 +51,8 @@ type reader struct {
scratch [4]byte scratch [4]byte
} }
// NewReader creates a new io.ReadCloser that satisfies reads by decompressing data read from r. // NewReader creates a new io.ReadCloser.
// Reads from the returned io.ReadCloser read and decompress data from r.
// The implementation buffers input and may read more data than necessary from r. // The implementation buffers input and may read more 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.
func NewReader(r io.Reader) (io.ReadCloser, error) { func NewReader(r io.Reader) (io.ReadCloser, error) {
......
...@@ -34,8 +34,8 @@ type Writer struct { ...@@ -34,8 +34,8 @@ type Writer struct {
wroteHeader bool wroteHeader bool
} }
// NewWriter creates a new Writer that satisfies writes by compressing data // NewWriter creates a new Writer.
// written to w. // Writes to the returned Writer are compressed and written to w.
// //
// It is the caller's responsibility to call Close on the WriteCloser when done. // It is the caller's responsibility to call Close on the WriteCloser when done.
// Writes may be buffered and not flushed until Close. // Writes may be buffered and not flushed until Close.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment