package pbufio

Import Path
	github.com/gobwas/pool/pbufio (on go.dev)

Dependency Relation
	imports 3 packages, and imported by one package

Involved Source Files Package pbufio contains tools for pooling bufio.Reader and bufio.Writers. pbufio_go110.go
Package-Level Type Names (total 2)
/* sort by: | */
ReaderPool contains logic of *bufio.Reader reuse with various size. Get returns bufio.Reader whose buffer has at least size bytes. Put takes ownership of bufio.Reader for further reuse. func CustomReaderPool(opts ...pool.Option) *ReaderPool func NewReaderPool(min, max int) *ReaderPool var DefaultReaderPool *ReaderPool
WriterPool contains logic of *bufio.Writer reuse with various size. Get returns bufio.Writer whose buffer has at least size bytes. Put takes ownership of bufio.Writer for further reuse. func CustomWriterPool(opts ...pool.Option) *WriterPool func NewWriterPool(min, max int) *WriterPool var DefaultWriterPool *WriterPool
Package-Level Functions (total 8)
CustomReaderPool creates new ReaderPool with given options.
CustomWriterPool creates new WriterPool with given options.
GetReader returns bufio.Reader whose buffer has at least size bytes. It returns its capacity for further pass to Put(). Note that size could be ceiled to the next power of two. GetReader is a wrapper around DefaultReaderPool.Get().
GetWriter returns bufio.Writer whose buffer has at least size bytes. Note that size could be ceiled to the next power of two. GetWriter is a wrapper around DefaultWriterPool.Get().
NewReaderPool creates new ReaderPool that reuses writers which size is in logarithmic range [min, max].
NewWriterPool creates new WriterPool that reuses writers which size is in logarithmic range [min, max].
PutReader takes bufio.Reader and its size for future reuse. It does not reuse bufio.Reader if size is not power of two or is out of pool min/max range. PutReader is a wrapper around DefaultReaderPool.Put().
PutWriter takes bufio.Writer for future reuse. It does not reuse bufio.Writer which underlying buffer size is not power of PutWriter is a wrapper around DefaultWriterPool.Put().
Package-Level Variables (total 2)