Search Results for

    Show / Hide Table of Contents

    Class 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:

    • taking exactly one argument of type ExtendedActorSystem; this should be the preferred one because all reflective loading of classes during deserialization should use ExtendedActorSystem.dynamicAccess (see [[akka.actor.DynamicAccess]]), and
    • without arguments, which is only an option if the serializer does not load classes using reflection.

    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.

    Inheritance
    object
    Serializer
    PersistenceMessageSerializer
    PersistenceSnapshotSerializer
    DaemonMsgCreateSerializer
    MessageContainerSerializer
    ProtobufSerializer
    SystemMessageSerializer
    ByteArraySerializer
    HyperionSerializer
    NewtonSoftJsonSerializer
    NullSerializer
    SerializerWithStringManifest
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Serialization
    Assembly: Akka.dll
    Syntax
    public abstract class Serializer

    Constructors

    | Edit this page View Source

    Serializer(ExtendedActorSystem)

    Initializes a new instance of the Serializer class.

    Declaration
    protected Serializer(ExtendedActorSystem system)
    Parameters
    Type Name Description
    ExtendedActorSystem system

    The actor system to associate with this serializer.

    Fields

    | Edit this page View Source

    system

    The actor system to associate with this serializer.

    Declaration
    protected readonly ExtendedActorSystem system
    Field Value
    Type Description
    ExtendedActorSystem

    Properties

    | Edit this page View Source

    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

    Declaration
    public virtual int Identifier { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    IncludeManifest

    Returns whether this serializer needs a manifest in the fromBinary method

    Declaration
    public abstract bool IncludeManifest { get; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    FromBinary(byte[], Type)

    Deserializes a byte array into an object of type type.

    Declaration
    public abstract object FromBinary(byte[] bytes, Type type)
    Parameters
    Type Name Description
    byte[] bytes

    The array containing the serialized object

    Type type

    The type of object contained in the array

    Returns
    Type Description
    object

    The object contained in the array

    | Edit this page View Source

    FromBinary<T>(byte[])

    Deserializes a byte array into an object.

    Declaration
    public T FromBinary<T>(byte[] bytes)
    Parameters
    Type Name Description
    byte[] bytes

    The array containing the serialized object

    Returns
    Type Description
    T

    The object contained in the array

    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ToBinary(object)

    Serializes the given object into a byte array

    Declaration
    public abstract byte[] ToBinary(object obj)
    Parameters
    Type Name Description
    object obj

    The object to serialize

    Returns
    Type Description
    byte[]

    A byte array containing the serialized object

    | Edit this page View Source

    ToBinaryWithAddress(Address, object)

    Serializes the given object into a byte array and uses the given address to decorate serialized ActorRef's

    Declaration
    public byte[] ToBinaryWithAddress(Address address, object obj)
    Parameters
    Type Name Description
    Address address

    The address to use when serializing local ActorRef´s

    object obj

    The object to serialize

    Returns
    Type Description
    byte[]

    TBD

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET