NewInputStreamWithBufferSize creates a new InputStream with a specified minimum buffer size.
(r io.Reader, bufferSize int)
| 38 | |
| 39 | // NewInputStreamWithBufferSize creates a new InputStream with a specified minimum buffer size. |
| 40 | func NewInputStreamWithBufferSize(r io.Reader, bufferSize int) *InputStream { |
| 41 | buf := NewByteBufferFromReader(r, bufferSize) |
| 42 | return &InputStream{ |
| 43 | buffer: buf, |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | // Shrink compacts the internal buffer, dropping already-read bytes to reclaim memory. |
| 48 | // It applies a heuristic to avoid tiny frequent compactions and reallocates the backing |