2.2.5.2.2 Variable-Length Data Streams

Variable-length data streams consist of a stream of characters or a stream of bytes. The two types are similar, in that they both have a length rule and a data rule.

Characters

Variable-length character streams are defined by a length field followed by the data itself. There are two types of variable-length character streams, each dependent on the size of the length field (for example, a BYTE or USHORT). If the length field is zero, then no data follows the length field.

 B_VARCHAR        =   BYTELEN *CHAR
 US_VARCHAR       =   USHORTLEN *CHAR

Note that the lengths of B_VARCHAR and US_VARCHAR are given in Unicode characters.

Generic Bytes

Similar to the variable-length character stream, variable-length byte streams are defined by a length field followed by the data itself. There are three types of variable-length byte streams, each dependent on the size of the length field (for example, a BYTE, USHORT, or LONG). If the value of the length field is zero, then no data follows the length field.

 B_VARBYTE        =   BYTELEN *BYTE
 US_VARBYTE       =   USHORTLEN *BYTE
 L_VARBYTE        =   LONGLEN *BYTE