Reset frees the currently held buffer slice and starts reading from the provided slice. This allows reusing the reader object.
(s BufferSlice)
| 148 | // Reset frees the currently held buffer slice and starts reading from the |
| 149 | // provided slice. This allows reusing the reader object. |
| 150 | func (r *Reader) Reset(s BufferSlice) { |
| 151 | r.data.Free() |
| 152 | s.Ref() |
| 153 | r.data = s |
| 154 | r.len = s.Len() |
| 155 | r.bufferIdx = 0 |
| 156 | } |
| 157 | |
| 158 | // Close frees the underlying BufferSlice and never returns an error. Subsequent |
| 159 | // calls to Read will return (0, io.EOF). |