C# Класс MsgPack.Serialization.MessagePackSerializer

Defines non-generic interface of serializers and provides entry points for MessagePackSerializer{T} usage.
You cannot derived from this class directly, use MessagePackSerializer{T} instead. This class is intended to guarantee backward compatibilities of non generic API.
Наследование: IMessagePackSingleObjectSerializer
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
PackSingleObject ( object objectTree ) : byte[]

Serialize specified object to the array of Byte.

PackTo ( Packer packer, object objectTree ) : void

Serialize specified object with specified Packer.

UnpackFrom ( Unpacker unpacker ) : object

Deserialize object with specified Unpacker.

UnpackFromAsync ( Unpacker unpacker, CancellationToken cancellationToken ) : Task

Deserialize object with specified Unpacker asynchronously.

UnpackSingleObject ( byte buffer ) : object

Deserialize a single object from the array of Byte which contains a serialized object.

This method assumes that buffer contains single serialized object dedicatedly, so this method does not return any information related to actual consumed bytes.

This method is a counter part of PackSingleObject.

UnpackSingleObjectAsync ( byte buffer, CancellationToken cancellationToken ) : Task

Deserialize a single object from the array of Byte which contains a serialized object.

This method assumes that buffer contains single serialized object dedicatedly, so this method does not return any information related to actual consumed bytes.

This method is a counter part of PackSingleObjectAsync.

UnpackTo ( Unpacker unpacker, object collection ) : void

Deserialize collection items with specified Unpacker and stores them to collection.

UnpackToAsync ( Unpacker unpacker, object collection, CancellationToken cancellationToken ) : Task

Deserialize collection items with specified Unpacker and stores them to collection asynchronously.

Приватные методы

Метод Описание
InternalGetCapabilities ( ) : SerializerCapabilities
InternalPackSingleObject ( object objectTree ) : byte[]
InternalPackSingleObjectAsync ( object objectTree, CancellationToken cancellationToken ) : Task
InternalPackTo ( Packer packer, object objectTree ) : void
InternalPackToAsync ( Packer packer, object objectTree, CancellationToken cancellationToken ) : Task
InternalUnpackFrom ( Unpacker unpacker ) : object
InternalUnpackFromAsync ( Unpacker unpacker, CancellationToken cancellationToken ) : Task
InternalUnpackSingleObject ( byte buffer ) : object
InternalUnpackSingleObjectAsync ( byte buffer, CancellationToken cancellationToken ) : Task
InternalUnpackTo ( Unpacker unpacker, object collection ) : void
InternalUnpackToAsync ( Unpacker unpacker, object collection, CancellationToken cancellationToken ) : Task
MessagePackSerializer ( MsgPack.Serialization.SerializationContext ownerContext, PackerCompatibilityOptions packerCompatibilityOptions, SerializerCapabilities capabilities ) : System

Initializes a new instance of the MessagePackSerializer class.

PackSingleObjectAsync ( object objectTree, CancellationToken cancellationToken ) : Task
PackToAsync ( Packer packer, object objectTree, CancellationToken cancellationToken ) : Task
ThrowArgumentNullException ( string parameterName ) : void

Описание методов

PackSingleObject() публичный Метод

Serialize specified object to the array of Byte.
public PackSingleObject ( object objectTree ) : byte[]
objectTree object Object to be serialized.
Результат byte[]

PackTo() публичный Метод

Serialize specified object with specified Packer.
public PackTo ( Packer packer, object objectTree ) : void
packer Packer which packs values in .
objectTree object Object to be serialized.
Результат void

UnpackFrom() публичный Метод

Deserialize object with specified Unpacker.
public UnpackFrom ( Unpacker unpacker ) : object
unpacker Unpacker which unpacks values of resulting object tree.
Результат object

UnpackFromAsync() публичный Метод

Deserialize object with specified Unpacker asynchronously.
/// is null. /// /// Failed to deserialize object. /// /// Failed to deserialize object due to invalid stream. /// /// Failed to deserialize object due to invalid stream. /// /// The type of deserializing is not serializable even if it can be serialized. ///
public UnpackFromAsync ( Unpacker unpacker, CancellationToken cancellationToken ) : Task
unpacker Unpacker which unpacks values of resulting object tree.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

UnpackSingleObject() публичный Метод

Deserialize a single object from the array of Byte which contains a serialized object.

This method assumes that buffer contains single serialized object dedicatedly, so this method does not return any information related to actual consumed bytes.

This method is a counter part of PackSingleObject.

public UnpackSingleObject ( byte buffer ) : object
buffer byte An array of serialized value to be stored.
Результат object

UnpackSingleObjectAsync() публичный Метод

Deserialize a single object from the array of Byte which contains a serialized object.

This method assumes that buffer contains single serialized object dedicatedly, so this method does not return any information related to actual consumed bytes.

This method is a counter part of PackSingleObjectAsync.

/// is null. /// /// Failed to deserialize object. /// /// Failed to deserialize object due to invalid stream. /// /// Failed to deserialize object due to invalid stream. /// /// The type of deserializing is not serializable even if it can be serialized. ///
public UnpackSingleObjectAsync ( byte buffer, CancellationToken cancellationToken ) : Task
buffer byte An array of serialized value to be stored.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

UnpackTo() публичный Метод

Deserialize collection items with specified Unpacker and stores them to collection.
public UnpackTo ( Unpacker unpacker, object collection ) : void
unpacker Unpacker which unpacks values of resulting object tree.
collection object Collection that the items to be stored.
Результат void

UnpackToAsync() публичный Метод

Deserialize collection items with specified Unpacker and stores them to collection asynchronously.
/// is null. /// Or is null. /// /// is not compatible for this serializer. /// /// Failed to deserialize object. /// /// Failed to deserialize object due to invalid stream. /// /// Failed to deserialize object due to invalid stream. /// /// The type of deserializing is not mutable collection. ///
public UnpackToAsync ( Unpacker unpacker, object collection, CancellationToken cancellationToken ) : Task
unpacker Unpacker which unpacks values of resulting object tree.
collection object Collection that the items to be stored.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task