Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStreamTooLarge = errors.New("read too many bytes")
Functions ¶
Types ¶
type ReadCounter ¶
func CountReads ¶
func CountReads(r io.Reader) ReadCounter
func ReadAtMost ¶
func ReadAtMost(r io.Reader, size int64) ReadCounter
ReadAtMost, like ReadExactly, returns a reader that expects to read at most size bytes.
func ReadExactly ¶
func ReadExactly(r io.Reader, size int64) ReadCounter
ReadExactly returns a reader that expects to read exactly size number of bytes. If io.EOF is returned before reading size bytes, the error is replaced by io.ErrUnexpectedEOF. Similarly if, the reader reads past size bytes, the reader replaces the error with ErrStreamTooLarge.
Click to show internal directories.
Click to hide internal directories.