Get retrieves a Buffer from the pool, creating one if necessary.
()
| 42 | |
| 43 | // Get retrieves a Buffer from the pool, creating one if necessary. |
| 44 | func (p Pool) Get() *Buffer { |
| 45 | buf := p.p.Get() |
| 46 | buf.Reset() |
| 47 | buf.pool = p |
| 48 | return buf |
| 49 | } |
| 50 | |
| 51 | func (p Pool) put(buf *Buffer) { |
| 52 | p.p.Put(buf) |