GetZlibWriter returns a *zlib.Writer that is managed by a sync.Pool. Returns a writer that is reset with w and ready for use. After use, the *zlib.Writer should be put back into the sync.Pool by calling PutZlibWriter.
(w io.Writer)
| 63 | // After use, the *zlib.Writer should be put back into the sync.Pool |
| 64 | // by calling PutZlibWriter. |
| 65 | func GetZlibWriter(w io.Writer) *zlib.Writer { |
| 66 | z := zlibWriter.Get().(*zlib.Writer) |
| 67 | z.Reset(w) |
| 68 | return z |
| 69 | } |
| 70 | |
| 71 | // PutZlibWriter puts w back into its sync.Pool. |
| 72 | func PutZlibWriter(w *zlib.Writer) { |
searching dependent graphs…