mirror of
https://github.com/golang/go
synced 2024-11-19 22:04:44 -07:00
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
This commit is contained in:
parent
fe49aa5512
commit
cabdb85333
@ -22,8 +22,8 @@ const (
|
||||
DefaultCompression = flate.DefaultCompression
|
||||
)
|
||||
|
||||
// A Writer is an io.WriteCloser that satisfies writes by compressing data written
|
||||
// to its wrapped io.Writer.
|
||||
// A Writer is an io.WriteCloser.
|
||||
// Writes to a Writer are compressed and written to w.
|
||||
type Writer struct {
|
||||
Header
|
||||
w io.Writer
|
||||
@ -37,8 +37,8 @@ type Writer struct {
|
||||
err error
|
||||
}
|
||||
|
||||
// NewWriter creates a new Writer that satisfies writes by compressing data
|
||||
// written to w.
|
||||
// NewWriter returns a new Writer.
|
||||
// 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.
|
||||
// Writes may be buffered and not flushed until Close.
|
||||
|
@ -216,8 +216,8 @@ func (d *decoder) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewReader creates a new io.ReadCloser that satisfies reads by decompressing
|
||||
// the data read from r.
|
||||
// NewReader creates a new io.ReadCloser.
|
||||
// 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
|
||||
// finished reading.
|
||||
// The number of bits to use for literal codes, litWidth, must be in the
|
||||
|
@ -225,8 +225,8 @@ func (e *encoder) Close() error {
|
||||
return e.w.Flush()
|
||||
}
|
||||
|
||||
// NewWriter creates a new io.WriteCloser that satisfies writes by compressing
|
||||
// the data and writing it to w.
|
||||
// NewWriter creates a new io.WriteCloser.
|
||||
// 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
|
||||
// finished writing.
|
||||
// The number of bits to use for literal codes, litWidth, must be in the
|
||||
|
@ -51,7 +51,8 @@ type reader struct {
|
||||
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.
|
||||
// It is the caller's responsibility to call Close on the ReadCloser when done.
|
||||
func NewReader(r io.Reader) (io.ReadCloser, error) {
|
||||
|
@ -34,8 +34,8 @@ type Writer struct {
|
||||
wroteHeader bool
|
||||
}
|
||||
|
||||
// NewWriter creates a new Writer that satisfies writes by compressing data
|
||||
// written to w.
|
||||
// NewWriter creates a new Writer.
|
||||
// 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.
|
||||
// Writes may be buffered and not flushed until Close.
|
||||
|
Loading…
Reference in New Issue
Block a user