Function BinaryDecoder.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.

size_t doSkipItems();

Returns

Zero if there are no more items to skip and end of array/map is reached. Positive number if some items are found that cannot be skipped and the client needs to skip them individually.

Throws

IOException If the first byte cannot be read for any reason other than the end of the file, if the input stream has been closed, or if some other I/O error occurs.

Example

//                 4    -3    16
ubyte[] data = [0x08, 0x05, 0x20, 0x65];
auto decoder = binaryDecoder(data);
with (decoder) {
  assert(readArrayStart() == 4);
  assert(readArrayStart() == 3);
  assert(readFixed(1) == [0x65]);
}