Class DataSerializerBase | Package Manager UI website
docs.unity.cn
    Show / Hide Table of Contents

    Class DataSerializerBase

    Base abstraction class of the IDataSerializer interface.

    Inheritance
    System.Object
    DataSerializerBase
    JsonDataSerializer
    Namespace: UnityEngine.GameFoundation.DataPersistence
    Syntax
    public abstract class DataSerializerBase : IDataSerializer

    Properties

    isBinarySerializer

    Is the serializer binary. Default is set to true.

    Declaration
    public bool isBinarySerializer { get; protected set; }
    Property Value
    Type Description
    System.Boolean

    serializerName

    The serializer name.

    Declaration
    public string serializerName { get; protected set; }
    Property Value
    Type Description
    System.String

    Methods

    Deserialize(String, Type, Boolean)

    Public abstraction of the deserialize method that deserialize the data from a string as the type T and return it as an object. Can use encryption.

    Declaration
    public abstract object Deserialize(string data, Type t, bool encrypted = false)
    Parameters
    Type Name Description
    System.String data

    The data to deserialize as a string

    System.Type t

    The type of the data to be deserialized

    System.Boolean encrypted

    Is the deserialization encrypted

    Returns
    Type Description
    System.Object

    The deserialized data as an object

    Implements
    IDataSerializer.Deserialize(String, Type, Boolean)

    Deserialize<T>(Byte[], Boolean)

    Public abstraction of the deserialize method that deserialize the data from a byte array and return it as the type T. Can use encryption.

    Declaration
    public abstract T Deserialize<T>(byte[] data, bool encrypted = false)
    Parameters
    Type Name Description
    System.Byte[] data

    The data to deserialize as a byte array

    System.Boolean encrypted

    Is the deserialization encrypted

    Returns
    Type Description
    T

    The deserialized data as type T

    Type Parameters
    Name Description
    T

    The type of the data to be deserialized

    Implements
    IDataSerializer.Deserialize<T>(Byte[], Boolean)

    Deserialize<T>(Stream, Boolean)

    Public abstraction of the deserialize method that deserialize the data from a stream and return it as the type T. Can use encryption.

    Declaration
    public abstract T Deserialize<T>(Stream stream, bool encrypted = false)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream to deserialize

    System.Boolean encrypted

    Is the deserialization encrypted

    Returns
    Type Description
    T

    The deserialized data as type T

    Type Parameters
    Name Description
    T

    The type of the data to be deserialized

    Implements
    IDataSerializer.Deserialize<T>(Stream, Boolean)

    Deserialize<T>(String, Boolean)

    Public abstraction of the deserialize method that deserialize the data from a string and return it as the type T. Can use encryption.

    Declaration
    public abstract T Deserialize<T>(string data, bool encrypted = false)
    Parameters
    Type Name Description
    System.String data

    The data to deserialize as a string

    System.Boolean encrypted

    Is the deserialization encrypted

    Returns
    Type Description
    T

    The deserialized data as type T

    Type Parameters
    Name Description
    T

    The type of the data to be deserialized

    Implements
    IDataSerializer.Deserialize<T>(String, Boolean)

    IsBinary()

    Return a bool that indicate if the serializer is binary type.

    Declaration
    public bool IsBinary()
    Returns
    Type Description
    System.Boolean

    Whether or not the serializer is binary type

    Name()

    Get the name of the serializer.

    Declaration
    public string Name()
    Returns
    Type Description
    System.String

    The name of the serializer

    Serialize(Object)

    Public abstraction of the serialize method that serialize a data object and return the data as object.

    Declaration
    public abstract object Serialize(object data)
    Parameters
    Type Name Description
    System.Object data

    The data object to serialize

    Returns
    Type Description
    System.Object

    The serialized data as an object

    Implements
    IDataSerializer.Serialize(Object)

    Serialize(Object, Boolean)

    Public abstraction of the serialize method that serialize a data object and return the data as string. Can use encryption.

    Declaration
    public abstract string Serialize(object data, bool encrypted = false)
    Parameters
    Type Name Description
    System.Object data

    The data object to serialize

    System.Boolean encrypted

    Is the serialization encrypted

    Returns
    Type Description
    System.String

    The serialized data as an string

    Implements
    IDataSerializer.Serialize(Object, Boolean)

    Serialize<T>(T, Boolean)

    Public abstraction of the serialize method that serialize the data of a generic type T and return the data as string. Can use encryption.

    Declaration
    public abstract string Serialize<T>(T data, bool encrypted = false)
    Parameters
    Type Name Description
    T data

    The data as type T to serialize

    System.Boolean encrypted

    Is the serialization encrypted

    Returns
    Type Description
    System.String

    The serialized data as an string

    Type Parameters
    Name Description
    T

    The type of the data to be serialized

    Implements
    IDataSerializer.Serialize<T>(T, Boolean)

    Serialize<T>(T, Stream, Boolean)

    Public abstraction of the serialize method that serialize the data of a generic type T and write the data through a stream. Can use encryption.

    Declaration
    public abstract void Serialize<T>(T data, Stream stream, bool encrypted = false)
    Parameters
    Type Name Description
    T data

    The data as type T to serialize

    System.IO.Stream stream

    The stream through which the serialization is supposed to be written

    System.Boolean encrypted

    Is the serialization encrypted

    Type Parameters
    Name Description
    T

    The type of the data to be serialized

    Implements
    IDataSerializer.Serialize<T>(T, Stream, Boolean)
    Back to top Copyright © 2019 Unity Technologies
    Generated by DocFX