aboutsummaryrefslogtreecommitdiff
path: root/scanner.go
diff options
context:
space:
mode:
Diffstat (limited to 'scanner.go')
-rw-r--r--scanner.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/scanner.go b/scanner.go
index 4169f1f..0978ab4 100644
--- a/scanner.go
+++ b/scanner.go
@@ -52,6 +52,12 @@ func NewScanner(rs io.ReadSeeker) Scanner {
return Scanner{rs: rs}
}
+// Reset discards all state and prepares the Scanner to read from rs. It lets a
+// single Scanner be reused for multiple streams without reallocating.
+func (s *Scanner) Reset(rs io.ReadSeeker) {
+ *s = Scanner{rs: rs}
+}
+
// Next advances to the next top-level box. Returns false when there
// are no more boxes or an error occurs. Check Err() after the loop.
func (s *Scanner) Next() bool {