Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLimitedReader ¶
func GetLimitedReader(r io.Reader, n int64) *io.LimitedReader
GetLimitedReader returns LimitedReader for reading up to n bytes from r.
Return the used LimitedReader to pool when no longer needed via PutLimitedReader().
func PutFirstByteReader ¶ added in v1.110.28
func PutFirstByteReader(fbr *FirstByteReader)
PutFirstByteReader returns fbr to the pool.
The fbr cannot be used after returning to the pool.
func PutLimitedReader ¶
func PutLimitedReader(lr *io.LimitedReader)
PutLimitedReader returns lr to the pool, so it could be re-used via GetLimitedReader().
lr cannot be used after returning to the pool.
Types ¶
type FirstByteReader ¶ added in v1.110.28
type FirstByteReader struct {
// contains filtered or unexported fields
}
FirstByteReader is an io.Reader, which provides WaitForData() function for waiting for the next data from the wrapped reader.
This reader is useful for postponing resource allocations after the next chunk of data is read from the wrapped reader.
func GetFirstByteReader ¶ added in v1.110.28
func GetFirstByteReader(r io.Reader) *FirstByteReader
GetFirstByteReader returns FirstByteReader wrapper for r.
The returned FirstByteReader must be returned back to the pool when no longer needed, by calling PutFirstByteReader().
func (*FirstByteReader) Read ¶ added in v1.110.28
func (fbr *FirstByteReader) Read(p []byte) (int, error)
Read implements io.Reader for fbr.
func (*FirstByteReader) WaitForData ¶ added in v1.110.28
func (fbr *FirstByteReader) WaitForData()
WaitForData waits for the next chunk of data from the wrapped reader at fbr.