Serialization Formats
Wire Types
Wire types are used to encode different types of data in a specific format. This enumeration provides a list of wire types and their corresponding values.
WIRE_NULLRepresents a null wire. Used for consuming field orders without data. (Value: 0)WIRE_FALSERepresents a Boolean False. (Value: 1)WIRE_TRUERepresents a Boolean True. (Value: 2)WIRE_POSINTRepresents a Binary encoded positive Integer in BigEndian Order. (Value: 3)WIRE_NEGINTRepresents a Binary encoded negative Integer in BigEndian Order. The number is encoded as its absolute value and must be multiplied with -1 to get its actual value. (Value: 4)WIRE_RAWRepresents polo encoded bytes. (Value: 5)WIRE_WORDRepresents UTF-8 encoded string/bytes. (Value: 6)WIRE_FLOATRepresents some floating point data encoded in the IEEE754 standard (floats). (Value: 7)WIRE_DOCRepresents doc encoded data (string keyed maps, tagged structs, and Document objects). (Value: 13)WIRE_PACKRepresents pack encoded data (slices, arrays, maps, structs). (Value: 14)WIRE_LOADRepresents a load tag for compound wire type. (Value: 15)
Wire
A utility class for working with wire types.
- static isNull(wt)
Checks if a given wire type is null. A wire type is null if it is WireNull, has a value greater than 15, or is between 8 and 12 (reserved).
- Arguments:
wt – The wire type to check.
- Returns:
True if the wire type is null, false otherwise.
// Example
Wire.isNull(WIRE_NULL)
>> true
- static isCompound(wt)
Checks if a given wire type is a compound type. A compound type contains a load inside it.
- Arguments:
wt – The wire type to check.
- Returns:
True if the wire type is a compound type, false otherwise.
// Example
Wire.isCompound(WIRE_PACK)
>> true