Get 获取一个新的Buffer
()
| 27 | |
| 28 | // Get 获取一个新的Buffer |
| 29 | func (this *BufferPool) Get() (b *bytes.Buffer) { |
| 30 | var buffer = this.rawPool.Get().(*bytes.Buffer) |
| 31 | if buffer.Len() > 0 { |
| 32 | buffer.Reset() |
| 33 | } |
| 34 | return buffer |
| 35 | } |
| 36 | |
| 37 | // Put 放回一个使用过的byte slice |
| 38 | func (this *BufferPool) Put(b *bytes.Buffer) { |