NEW_TYPE = 11 ;
The NEW_TYPE primitive is used to specify a type which has not already been encountered by this serialization stream. It does not encode or represent an object. It can appear at any point in a serialization stream that an object can appear at. It is distinguishable from object encodings by its objectType field value.
When the serializer is created, it has a set of predefined types, as well as an index value for the first non-predefined type. The serialization stream header encodes both the predefined type set (via the serializer version number), and the first user type index (directly).
When a serializer encounters an object of a type which is not in its type table, it adds an entry to the type table at the next available typeID value. It also emits a NEW_TYPE primitive encoding the symbolic name for the type it has added. When the deserializer encounters a NEW_TYPE primitive, it creates a type entry from the symbolic type name encoded in the NEW_TYPE primitive, and places it in the next available slot in the type table.
The NEW_TYPE primitive consists of the objectType Integer (the byte
0B), followed by an Integer encoding the number of bytes
that the encoding of the symbolic type name string consumes, followed
by that many bytes of data. The bytes of data are the UTF encoding of
the UNICODE characters in the symbolic type name string.
None.
SerializedNewTypePrimitive {
Integer objectType; // == NEW_TYPE
Integer length;
byte value[length];
}
0B 0E 66 65 NEW_TYPE "ferd is a ferd" 72 64 20 69 73 20 61 20 66 65 72 64