Documentation ¶
Index ¶
Constants ¶
const EOFReader = eofreader(0)
EOFReader is an io.Reader with Read always giving an io.EOF.
Variables ¶
This section is empty.
Functions ¶
func Drain ¶
Drain reads from r until either io.EOF is reached on r or an error occurs. It returns the number of bytes read and the first error encountered while reading, if any. Note that on completing successful drain the second return value is nil and not io.EOF. Because Drain is defined to read from r until io.EOF, it does not treat an io.EOF from Read as an error to be reported.
Types ¶
type ByteCountWriter ¶
type ByteCountWriter struct { W io.Writer // The wrapped writer N int64 // The number of bytes written to the writer }
ByteCountWriter wraps an io.Writer and keeps track of the number of bytes that have been written to the wrapped writer.
func (*ByteCountWriter) ReadFrom ¶ added in v1.0.4
func (w *ByteCountWriter) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom ReadFrom reads data from r until EOF or error. The return value n is the number of bytes read. Any error except EOF encountered during the read is also returned.
func (*ByteCountWriter) Size ¶
func (w *ByteCountWriter) Size() int64
Size returns the number of bytes that have been written to the writer.