Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrReadTimeout = errors.New("read timed out")
ErrReadTimeout is the error used when a read times out before completing.
Functions ¶
This section is empty.
Types ¶
type TimeoutReader ¶
type TimeoutReader struct {
// contains filtered or unexported fields
}
An io.ReadCloser that has a timeout for each underlying Read() function and optionally closes the underlying Reader on timeout.
func NewTimeoutReader ¶
func NewTimeoutReader(reader io.ReadCloser, timeout time.Duration, closeOnTimeout bool) *TimeoutReader
Create a new TimeoutReader.
func NewTimeoutReaderSize ¶
func NewTimeoutReaderSize(reader io.ReadCloser, timeout time.Duration, closeOnTimeout bool, maxReadSize int) *TimeoutReader
func (*TimeoutReader) Close ¶
func (tr *TimeoutReader) Close() (err error)
Closes the TimeoutReader. Also closes the underlying Reader if it was not closed already at timeout.
Click to show internal directories.
Click to hide internal directories.