Documentation
¶
Overview ¶
Single-Buffer backing for readers.
Use when reading from a large Reader when only small defined sequential slices are needed. Uses a single buffer for reading.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNeedCap = errors.New("Requested more then buffer size.") ErrUsedTooMuch = errors.New("Used more then requested.") )
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer interface {
// Get the next slice of data. Will return at least "needed", but may return more.
// The returned slice should not be used after Next or Used is called.
// The returned slice may be shorter then needed if the inner read returns a short
// read (for example, returns an io.EOF).
Next(needed int) ([]byte, error)
// Called after using the slice returned from Next. This frees
// the underlying buffer for more data.
Used(used int)
}
Click to show internal directories.
Click to hide internal directories.