Given a `ByteReadPacket`, is there a way to peek i...
# ktor
e
Given a
ByteReadPacket
, is there a way to peek instead of reading? I don't want the read pointer to advance in certain circumstances
a
You use the
Input.tryPeek
and
Input.peekTo
methods.
e
Thanks @Aleksei Tirman [JB]. One thing I'm still failing to understand is how to get a
ChunkBuffer
. It seems you have to "borrow" it? Also I can't specify a size it seems
Got it probably:
Copy code
val buffer = ChunkBuffer(ByteBuffer.allocate(Int.SIZE_BYTES))
packet.peekTo(buffer)
👍 1