()
| 487 | } |
| 488 | |
| 489 | func (b *ByteBuffer) Reset() { |
| 490 | b.readerIndex = 0 |
| 491 | b.writerIndex = 0 |
| 492 | b.reader = nil |
| 493 | // Keep the underlying buffer if it's reasonable sized to reduce allocations |
| 494 | // Only nil it out if we want to release memory |
| 495 | if cap(b.data) > 64*1024 { |
| 496 | b.data = nil |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | func (b *ByteBuffer) ResetWithReader(r io.Reader, bufferSize int) { |
| 501 | b.readerIndex = 0 |
no outgoing calls