Source File
reset.go
Belonging Package
github.com/hamba/avro/v2/internal/bytesx
// Package bytesx implements bytes extensions.package bytesximport// ResetReader implements the io.Reader reading from a resettable byte slice.type ResetReader struct {buf []bytehead inttail int}// NewResetReader returns a new ResetReader reading from b.func ( []byte) *ResetReader {:= &ResetReader{}.Reset()return}// Read reads bytes into p.func ( *ResetReader) ( []byte) (int, error) {if .head == .tail {return 0, io.EOF}:= copy(, .buf[.head:]).head +=return , nil}// Reset resets the byte slice being read from.func ( *ResetReader) ( []byte) {.buf =.head = 0.tail = len()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |