util/buffer: add Reset() method
closes #402 Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		| @@ -67,6 +67,12 @@ func (b *SeekerBuffer) Close() error { | |||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Reset clears all the data out of the buffer and sets the read position to 0. | ||||||
|  | func (b *SeekerBuffer) Reset() { | ||||||
|  | 	b.data = nil | ||||||
|  | 	b.pos = 0 | ||||||
|  | } | ||||||
|  |  | ||||||
| // Len returns the length of data remaining to be read. | // Len returns the length of data remaining to be read. | ||||||
| func (b *SeekerBuffer) Len() int { | func (b *SeekerBuffer) Len() int { | ||||||
| 	return len(b.data[b.pos:]) | 	return len(b.data[b.pos:]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user