BinaryFormat.Length
Επιστρέφει μια δυαδική μορφή που περιορίζει την ποσότητα των δεδομένων που μπορούν να αναγνωστούν.
Syntax
BinaryFormat.Length(
binaryFormat as function,
length as any
) as function
Remarks
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 specifies 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 precedes the value being read.
Examples
Example #1
Περιορίστε τον αριθμό των byte που διαβάζονται σε 2 κατά την ανάγνωση μιας λίστας byte.
let
binaryData = #binary({1, 2, 3}),
listFormat = BinaryFormat.Length(
BinaryFormat.List(BinaryFormat.Byte),
2
)
in
listFormat(binaryData)
Result:
{1, 2}
Example #2
Περιορισμός του αριθμού των byte που διαβάζονται κατά την ανάγνωση μιας λίστας byte στην τιμή byte που προηγείται της λίστας.
let
binaryData = #binary({1, 2, 3}),
listFormat = BinaryFormat.Length(
BinaryFormat.List(BinaryFormat.Byte),
BinaryFormat.Byte
)
in
listFormat(binaryData)
Result:
{2}
Category
Binary Formats.Limiting input