takeSmallBuffer is shortcut which can be used if length is known to be smaller than defaultBufSize. Only one buffer (total) can be used at a time.
(length int)
| 124 | // known to be smaller than defaultBufSize. |
| 125 | // Only one buffer (total) can be used at a time. |
| 126 | func (b *buffer) takeSmallBuffer(length int) ([]byte, error) { |
| 127 | if b.busy() { |
| 128 | return nil, ErrBusyBuffer |
| 129 | } |
| 130 | return b.cachedBuf[:length], nil |
| 131 | } |
| 132 | |
| 133 | // takeCompleteBuffer returns the complete existing buffer. |
| 134 | // This can be used if the necessary buffer size is unknown. |
no test coverage detected