Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeflatePool ¶
type DeflatePool struct {
// contains filtered or unexported fields
}
DeflatePool manages a pool of flate.Writer flate.NewWriter allocates a lot of memory, so if flate.Writer are needed frequently, it's more efficient to use a pool of them. The pool uses sync.Pool internally.
There is no pool for flate readers, because they implement io.ReadCloser and can't be recycled after closing.
var Pool DeflatePool
func (*DeflatePool) GetWriter ¶
func (pool *DeflatePool) GetWriter(dst io.Writer) (writer *flate.Writer)
GetWriter returns flate.Writer from the pool, or creates a new one with flate.BestCompression if the pool is empty.
func (*DeflatePool) PutWriter ¶
func (pool *DeflatePool) PutWriter(writer *flate.Writer)
PutWriter returns a flate.Writer to the pool that can late be reused via GetWriter. Don't close the writer, Flush will be called before returning it to the pool.
Click to show internal directories.
Click to hide internal directories.