Add ReadRemaining helper

This commit is contained in:
iteye 2026-07-03 17:46:45 +08:00
parent 10a17d62aa
commit 21f37aefb4

View file

@ -120,3 +120,10 @@ func (bb *ByteBuffer) GetVarBytes(byteSizeOfSliceLen int) ([]byte, error) {
func (bb *ByteBuffer) Remaining() int {
return bb.size - bb.position
}
// ReadRemaining returns all unread bytes in the buffer.
// Used by types that need to consume the rest of the buffer (e.g. opaque
// placeholder types for forward-compatible deserialization).
func (bb *ByteBuffer) ReadRemaining() ([]byte, error) {
return bb.getBytes(bb.Remaining())
}