From 8b406cf963833a833f09809c12086430f7248143 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 12 May 2025 19:18:45 +0300 Subject: [PATCH] util/buffer: add Reset() method closes #402 Signed-off-by: Vasiliy Tolstov --- util/buffer/seeker_buffer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/buffer/seeker_buffer.go b/util/buffer/seeker_buffer.go index 0ecfc71e..5d48c826 100644 --- a/util/buffer/seeker_buffer.go +++ b/util/buffer/seeker_buffer.go @@ -67,6 +67,12 @@ func (b *SeekerBuffer) Close() error { 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. func (b *SeekerBuffer) Len() int { return len(b.data[b.pos:])