Class BinaryDecoder

A [Decoder] for binary-format data.

class BinaryDecoder(IRangeT)
  
if (isInputRange!IRangeT && is(ElementType!IRangeT : ubyte));

This class may read-ahead and buffer bytes from the source beyond what is required to serve its read methods. The number of unused bytes in the buffer can be accessed by inputStream().remaining(), if the BinaryDecoder is not 'direct'.

Methods

NameDescription
doReadItemCount () Returns the number of items to follow in the current array or map. Returns 0 if there are no more items in the current array and the array/map has ended. Arrays are encoded as a series of blocks. Each block consists of a long count value, followed by that many array items. A block with count zero indicates the end of the array. If a block's count is negative, its absolute value is used, and the count is followed immediately by a long block size indicating the number of bytes in the block.
doReadLong () Reads bytes from the input stream to decode a variable-length zigzag integer.
doSkipItems () Reads the count of items in the current array or map and skip those items, if possible. If it could skip the items, keep repeating until there are no more items left in the array or map. Arrays are encoded as a series of blocks. Each block consists of a long count value, followed by that many array items. A block with count zero indicates the end of the array. If a block's count is negative, its absolute value is used, and the count is followed immediately by a long block size indicating the number of bytes in the block. If block size is missing, this method return the count of the items found. The client needs to skip the items individually.
readArrayNext ()
readEnum (enumSchema)
readMapNext ()
readMapStart ()
readUnionIndex (unionSchema)
skipMap ()

See Also

[Encoder]