Class CompatibleFieldSerializer<T>
- All Implemented Interfaces:
Comparator<FieldSerializer.CachedField>
There is additional overhead compared to FieldSerializer
. A header is output the first time an object of a given type
is serialized. The header consists of an int for the number of fields, then a String for each field name. Also, to support
skipping the bytes for a field that no longer exists, for each field value an int is written that is the length of the value in
bytes.
Note that the field data is identified by name. The situation where a super class has a field with the same name as a subclass must be avoided.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.esotericsoftware.kryo.serializers.FieldSerializer
FieldSerializer.CachedField<X>, FieldSerializer.Optional
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.esotericsoftware.kryo.serializers.FieldSerializer
compare, copy, create, createCopy, getField, getFields, getType, initializeCachedFields, removeField, setFieldsAsAccessible, setFieldsCanBeNull, setFixedFieldTypes, setIgnoreSyntheticFields
Methods inherited from class com.esotericsoftware.kryo.Serializer
getAcceptsNull, isImmutable, setAcceptsNull, setGenerics, setImmutable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
CompatibleFieldSerializer
-
-
Method Details
-
write
Description copied from class:Serializer
Writes the bytes for the object to the output.This method should not be called directly, instead this serializer can be passed to
Kryo
write methods that accept a serialier.- Overrides:
write
in classFieldSerializer<T>
object
- May be null ifSerializer.getAcceptsNull()
is true.
-
read
Description copied from class:Serializer
Reads bytes and returns a new object of the specified concrete type.Before Kryo can be used to read child objects,
Kryo.reference(Object)
must be called with the parent object to ensure it can be referenced by the child objects. Any serializer that usesKryo
to read a child object may need to be reentrant.This method should not be called directly, instead this serializer can be passed to
Kryo
read methods that accept a serialier.- Overrides:
read
in classFieldSerializer<T>
- Returns:
- May be null if
Serializer.getAcceptsNull()
is true.
-