Documentation ¶
Index ¶
- func GetBufioReader(reader io.Reader) *bufio.Reader
- func GetByteSlice() *[]byte
- func GetBytesBuffer() *bytes.Buffer
- func GetZlibWriter(w io.Writer) *zlib.Writer
- func PutBufioReader(reader *bufio.Reader)
- func PutByteSlice(buf *[]byte)
- func PutBytesBuffer(buf *bytes.Buffer)
- func PutZlibReader(z ZLibReader)
- func PutZlibWriter(w *zlib.Writer)
- type ZLibReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBufioReader ¶
GetBufioReader returns a *bufio.Reader that is managed by a sync.Pool. Returns a bufio.Reader that is resetted with reader and ready for use.
After use, the *bufio.Reader should be put back into the sync.Pool by calling PutBufioReader.
func GetByteSlice ¶
func GetByteSlice() *[]byte
GetByteSlice returns a *[]byte that is managed by a sync.Pool. The initial slice length will be 16384 (16kb).
After use, the *[]byte should be put back into the sync.Pool by calling PutByteSlice.
func GetBytesBuffer ¶
GetBytesBuffer returns a *bytes.Buffer that is managed by a sync.Pool. Returns a buffer that is resetted and ready for use.
After use, the *bytes.Buffer should be put back into the sync.Pool by calling PutBytesBuffer.
func GetZlibWriter ¶
GetZlibWriter returns a *zlib.Writer that is managed by a sync.Pool. Returns a writer that is resetted with w and ready for use.
After use, the *zlib.Writer should be put back into the sync.Pool by calling PutZlibWriter.
func PutBufioReader ¶
PutBufioReader puts reader back into its sync.Pool.
func PutBytesBuffer ¶
PutBytesBuffer puts buf back into its sync.Pool.
func PutZlibReader ¶
func PutZlibReader(z ZLibReader)
PutZlibReader puts z back into its sync.Pool, first closing the reader. The Byte slice dictionary is also put back into its sync.Pool.
func PutZlibWriter ¶
PutZlibWriter puts w back into its sync.Pool.
Types ¶
type ZLibReader ¶
type ZLibReader struct { Reader zlibReadCloser // contains filtered or unexported fields }
func GetZlibReader ¶
func GetZlibReader(r io.Reader) (ZLibReader, error)
GetZlibReader returns a ZLibReader that is managed by a sync.Pool. Returns a ZLibReader that is resetted using a dictionary that is also managed by a sync.Pool.
After use, the ZLibReader should be put back into the sync.Pool by calling PutZlibReader.