From 21f37aefb4dfbcc55e5aa3d203b043b7caf61154 Mon Sep 17 00:00:00 2001 From: iteye Date: Fri, 3 Jul 2026 17:46:45 +0800 Subject: [PATCH] Add ReadRemaining helper --- qkc/serialize/bytebuffer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qkc/serialize/bytebuffer.go b/qkc/serialize/bytebuffer.go index 3356747882..40286bf9d6 100644 --- a/qkc/serialize/bytebuffer.go +++ b/qkc/serialize/bytebuffer.go @@ -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()) +}