public interface Serializer
Serializers are loaded using reflection during ActorSystem
start-up, where two constructors are tried in order:
ExtendedActorSystem
;
this should be the preferred one because all reflective loading of classes
during deserialization should use ExtendedActorSystem.dynamicAccess (see
DynamicAccess
), and
Be sure to always use the DynamicAccess
for loading classes! This is necessary to
avoid strange match errors and inequalities which arise from different class loaders loading
the same class.
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
fromBinary(byte[] bytes)
Java API: deserialize without type hint
|
java.lang.Object |
fromBinary(byte[] bytes,
java.lang.Class<?> clazz)
Java API: deserialize with type hint
|
java.lang.Object |
fromBinary(byte[] bytes,
scala.Option<java.lang.Class<?>> manifest)
Produces an object from an array of bytes, with an optional type-hint;
the class should be loaded using ActorSystem.dynamicAccess.
|
int |
identifier()
Completely unique value to identify this implementation of Serializer, used to optimize network traffic.
|
boolean |
includeManifest()
Returns whether this serializer needs a manifest in the fromBinary method
|
byte[] |
toBinary(java.lang.Object o)
Serializes the given object into an Array of Byte
|
int identifier()
byte[] toBinary(java.lang.Object o)
o
- (undocumented)boolean includeManifest()
java.lang.Object fromBinary(byte[] bytes, scala.Option<java.lang.Class<?>> manifest)
bytes
- (undocumented)manifest
- (undocumented)java.lang.Object fromBinary(byte[] bytes)
bytes
- (undocumented)java.lang.Object fromBinary(byte[] bytes, java.lang.Class<?> clazz)
bytes
- (undocumented)clazz
- (undocumented)