public class ExternalizableSerializer extends Serializer
JavaSerializer if we detect either of these methods.
Note that this class does not specialize the type on Externalizable. That is because if
we fall back on the JavaSerializer it may have an readResolve method that returns
an object of a different type.| Modifier and Type | Field and Description |
|---|---|
private ObjectMap<java.lang.Class,JavaSerializer> |
javaSerializerByType |
private KryoObjectInput |
objectInput |
private KryoObjectOutput |
objectOutput |
| Constructor and Description |
|---|
ExternalizableSerializer() |
| Modifier and Type | Method and Description |
|---|---|
private JavaSerializer |
getCachedSerializer(java.lang.Class type) |
private JavaSerializer |
getJavaSerializerIfRequired(java.lang.Class type)
Determines if this class requires the fall-back
JavaSerializer. |
private java.io.ObjectInput |
getObjectInput(Kryo kryo,
Input input) |
private java.io.ObjectOutput |
getObjectOutput(Kryo kryo,
Output output) |
private static boolean |
hasInheritableReplaceMethod(java.lang.Class type,
java.lang.String methodName) |
private boolean |
isJavaSerializerRequired(java.lang.Class type) |
java.lang.Object |
read(Kryo kryo,
Input input,
java.lang.Class type)
Reads bytes and returns a new object of the specified concrete type.
|
private java.lang.Object |
readExternal(Kryo kryo,
Input input,
java.lang.Class type) |
void |
write(Kryo kryo,
Output output,
java.lang.Object object)
Writes the bytes for the object to the output.
|
private void |
writeExternal(Kryo kryo,
Output output,
java.lang.Object object) |
copy, getAcceptsNull, isImmutable, setAcceptsNull, setGenerics, setImmutableprivate ObjectMap<java.lang.Class,JavaSerializer> javaSerializerByType
private KryoObjectInput objectInput
private KryoObjectOutput objectOutput
public void write(Kryo kryo, Output output, java.lang.Object object)
Serializer
This method should not be called directly, instead this serializer can be passed to Kryo write methods that accept a
serialier.
write in class Serializerobject - May be null if Serializer.getAcceptsNull() is true.public java.lang.Object read(Kryo kryo, Input input, java.lang.Class type)
Serializer
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 uses Kryo 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.
read in class SerializerSerializer.getAcceptsNull() is true.private JavaSerializer getJavaSerializerIfRequired(java.lang.Class type)
JavaSerializer. If the class does
not require any specialized Java serialization features then null will be returned.type - the type we wish to externalizeJavaSerializer if the type requires more than simple externalization.private JavaSerializer getCachedSerializer(java.lang.Class type)
private boolean isJavaSerializerRequired(java.lang.Class type)
private static boolean hasInheritableReplaceMethod(java.lang.Class type,
java.lang.String methodName)