DecodeBuffer
Defined in: packages/format-core/src/decode-buffer.ts:13
Accumulates and windows the units a Decoder reads.
Chunk is the type appended (what arrives) and View is the type read back
(what a decoder sees); they diverge for a non-contiguous backing — appending
Uint8Array chunks while viewing them through a ByteCursor — so a single
type parameter would be inexpressible here.
Type Parameters
Section titled “Type Parameters”View
Chunk = View
What append accepts. Defaults to View for the
common contiguous case.
Properties
Section titled “Properties”buffered
Section titled “buffered”
readonlybuffered:number
Defined in: packages/format-core/src/decode-buffer.ts:15
Unconsumed unit count currently held.
Methods
Section titled “Methods”append()
Section titled “append()”append(
chunk):void
Defined in: packages/format-core/src/decode-buffer.ts:18
Append chunk, growing or compacting the backing as needed.
Parameters
Section titled “Parameters”Chunk
Returns
Section titled “Returns”void
clear()
Section titled “clear()”clear():
void
Defined in: packages/format-core/src/decode-buffer.ts:43
Discard everything held.
Returns
Section titled “Returns”void
consume()
Section titled “consume()”consume(
count):void
Defined in: packages/format-core/src/decode-buffer.ts:37
Drop count units from the front.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
finish()?
Section titled “finish()?”
optionalfinish():void
Defined in: packages/format-core/src/decode-buffer.ts:28
Release anything the backing is holding back pending more input, called once when no further append will happen.
Only a converting backing needs this — a TextDecoder withholds the bytes
of a sequence split across a chunk boundary, and at end of input they must
become a replacement character rather than vanish.
Returns
Section titled “Returns”void
take()
Section titled “take()”take():
Chunk
Defined in: packages/format-core/src/decode-buffer.ts:40
Remove and return the unconsumed units, resetting the buffer.
Returns
Section titled “Returns”Chunk
view()
Section titled “view()”view():
View
Defined in: packages/format-core/src/decode-buffer.ts:34
Window over the unconsumed units. Invalidated by the next append or consume; copy before retaining.
Returns
Section titled “Returns”View