BinaryFormat.Length
Returns a binary format that limits the amount of data that can be read.
function (binaryFormat
as function, optionallength
as nullable any) as function
Returns a binary format that limits the amount of data that can be read. Both
BinaryFormat.List
and BinaryFormat.Binary
can be used to read until end of the data. BinaryFormat.Length
can be used to limit the number of bytes that are read. The binaryFormat
parameter specifes the binary format to limit. The length
parameter specifies the number of bytes to read. The length
parameter may either be a number value, or a binary format value that specifies the format of the length value that appears that preceeds the value being read.Binary Formats.Limiting input
Limit the number of bytes read to 2 when reading a list of bytes.
let
binaryData = #binary({1, 2, 3}),
listFormat = BinaryFormat.Length(
BinaryFormat.List(BinaryFormat.Byte), 2)
in
listFormat(binaryData)
{1, 2}
Limit the number of byte read when reading a list of bytes to the byte value preceeding the list.
let
binaryData = #binary({1, 2, 3}),
listFormat = BinaryFormat.Length(
BinaryFormat.List(BinaryFormat.Byte), BinaryFormat.Byte)
in
listFormat(binaryData)
{2}
Last modified 4yr ago