akka.serialization
Interface Serializer

All Known Implementing Classes:
ByteArraySerializer, ClusterMessageSerializer, DistributedPubSubMessageSerializer, JavaSerializer, JSerializer, MessageContainerSerializer, MessageSerializer, NullSerializer, NullSerializer$, ProtobufSerializer, SnapshotSerializer

public interface Serializer

A Serializer represents a bimap between an object and an array of bytes representing that object.

Serializers are loaded using reflection during ActorSystem start-up, where two constructors are tried in order:

Be sure to always use the PropertyManager for loading classes! This is necessary to avoid strange match errors and inequalities which arise from different class loaders loading the same class.


Method Summary
 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 Values from 0 to 16 is reserved for Akka internal usage
 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
 

Method Detail

identifier

int identifier()
Completely unique value to identify this implementation of Serializer, used to optimize network traffic Values from 0 to 16 is reserved for Akka internal usage


toBinary

byte[] toBinary(java.lang.Object o)
Serializes the given object into an Array of Byte


includeManifest

boolean includeManifest()
Returns whether this serializer needs a manifest in the fromBinary method


fromBinary

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.


fromBinary

java.lang.Object fromBinary(byte[] bytes)
Java API: deserialize without type hint


fromBinary

java.lang.Object fromBinary(byte[] bytes,
                            java.lang.Class<?> clazz)
Java API: deserialize with type hint