C# Класс MsgPack.Packer

Implements serialization feature of MsgPack.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Create ( Stream stream ) : Packer

Create standard Safe Packer instancde wrapping specified Stream with DefaultCompatibilityOptions.

You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.

Create ( Stream stream, PackerCompatibilityOptions compatibilityOptions ) : Packer

Create standard Safe Packer instancde wrapping specified Stream with specified PackerCompatibilityOptions.

You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.

Create ( Stream stream, PackerCompatibilityOptions compatibilityOptions, PackerUnpackerStreamOptions streamOptions ) : Packer

Create standard Safe Packer instancde wrapping specified Stream with specified PackerCompatibilityOptions.

You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.

Create ( Stream stream, PackerCompatibilityOptions compatibilityOptions, bool ownsStream ) : Packer

Create standard Safe Packer instancde wrapping specified Stream with specified PackerCompatibilityOptions.

You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.

Create ( Stream stream, bool ownsStream ) : Packer

Create standard Safe Packer instancde wrapping specified Stream with DefaultCompatibilityOptions.

You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.

Dispose ( ) : void

Clean up internal resources.

Flush ( ) : void

Flushes internal buffer (including underlying stream).

FlushAsync ( ) : Task

Flushes internal buffer (including underlying stream) asynchronously.

FlushAsync ( CancellationToken cancellationToken ) : Task

Flushes internal buffer (including underlying stream) asynchronously.

Pack ( System.Boolean value ) : Packer

Pack nullable Boolean value.

Pack ( Byte value ) : Packer

Pack nullable Byte value.

Pack ( Double value ) : Packer

Pack nullable Double value.

Pack ( Int16 value ) : Packer

Pack nullable Int16 value.

Pack ( Int32 value ) : Packer

Pack nullable Int32 value.

Pack ( System.Int64 value ) : Packer

Pack nullable Int64 value.

Pack ( System.Single value ) : Packer

Pack nullable Single value.

Pack ( bool value ) : Packer

Packs Boolean value to current stream.

Pack ( byte value ) : Packer

Packs Byte value to current stream.

PackAsync ( System.Boolean value ) : Task

Pack nullable Boolean value asynchronously.

PackAsync ( System.Boolean value, CancellationToken cancellationToken ) : Task

Pack nullable Boolean value asynchronously.

PackAsync ( Byte value ) : Task

Pack nullable Byte value asynchronously.

PackAsync ( Byte value, CancellationToken cancellationToken ) : Task

Pack nullable Byte value asynchronously.

PackAsync ( Double value ) : Task

Pack nullable Double value asynchronously.

PackAsync ( Double value, CancellationToken cancellationToken ) : Task

Pack nullable Double value asynchronously.

PackAsync ( Int16 value ) : Task

Pack nullable Int16 value asynchronously.

PackAsync ( Int16 value, CancellationToken cancellationToken ) : Task

Pack nullable Int16 value asynchronously.

PackAsync ( Int32 value ) : Task

Pack nullable Int32 value asynchronously.

PackAsync ( Int32 value, CancellationToken cancellationToken ) : Task

Pack nullable Int32 value asynchronously.

PackAsync ( System.Int64 value ) : Task

Pack nullable Int64 value asynchronously.

PackAsync ( System.Int64 value, CancellationToken cancellationToken ) : Task

Pack nullable Int64 value asynchronously.

PackAsync ( System.Single value ) : Task

Pack nullable Single value asynchronously.

PackAsync ( System.Single value, CancellationToken cancellationToken ) : Task

Pack nullable Single value asynchronously.

PackAsync ( bool value ) : Task

Packs Boolean value to current stream asynchronously.

PackAsync ( bool value, CancellationToken cancellationToken ) : Task

Packs Boolean value to current stream asynchronously.

PackAsync ( byte value ) : Task

Packs Byte value to current stream asynchronously.

PackAsync ( byte value, CancellationToken cancellationToken ) : Task

Packs Byte value to current stream asynchronously.

PackNull ( ) : Packer

Packs a null value to current stream.

PackNullAsync ( ) : Task

Packs a null value to current stream asynchronously.

PackNullAsync ( CancellationToken cancellationToken ) : Task

Packs a null value to current stream asynchronously.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

When overridden by derived class, release all unmanaged resources, optionally release managed resources.

Packer ( ) : System

Initializes a new instance of the Packer class with DefaultCompatibilityOptions.

Packer ( PackerCompatibilityOptions compatibilityOptions ) : System

Initializes a new instance of the Packer class with specified PackerCompatibilityOptions.

SeekTo ( long offset ) : void

When overridden by derived class, change current position to specified offset.

TryPackInt8 ( long value ) : bool

Try packs SByte value to current stream strictly.

TryPackInt8Async ( long value ) : Task

Try packs SByte value to current stream strictly asynchronously.

TryPackInt8Async ( long value, CancellationToken cancellationToken ) : Task

Try packs SByte value to current stream strictly asynchronously.

TryPackTinySignedInteger ( long value ) : bool

Try packs SByte value to current stream as tiny fix num.

TryPackTinySignedIntegerAsync ( long value ) : Task

Try packs SByte value to current stream as tiny fix num asynchronously.

TryPackTinySignedIntegerAsync ( long value, CancellationToken cancellationToken ) : Task

Try packs SByte value to current stream as tiny fix num asynchronously.

WriteByte ( byte value ) : void

When overridden by derived class, writes specified byte to stream using implementation specific manner.

WriteByteAsync ( byte value ) : Task

When overridden by derived class, writes specified byte to stream using implementation specific manner asynchronously.

WriteByteAsync ( byte value, CancellationToken cancellationToken ) : Task

When overridden by derived class, writes specified byte to stream using implementation specific manner asynchronously.

WriteBytesAsync ( ICollection value ) : Task

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.

WriteBytesAsync ( ICollection value, CancellationToken cancellationToken ) : Task

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.

WriteBytesAsync ( byte value, bool isImmutable ) : Task

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.

WriteBytesAsync ( byte value, bool isImmutable, CancellationToken cancellationToken ) : Task

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.

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

Метод Описание
Pack ( SByte value ) : Packer
Pack ( UInt16 value ) : Packer
Pack ( UInt32 value ) : Packer
Pack ( System.UInt64 value ) : Packer
Pack ( sbyte value ) : Packer
PackAsync ( SByte value ) : Task
PackAsync ( SByte value, CancellationToken cancellationToken ) : Task
PackAsync ( UInt16 value ) : Task
PackAsync ( UInt16 value, CancellationToken cancellationToken ) : Task
PackAsync ( UInt32 value ) : Task
PackAsync ( UInt32 value, CancellationToken cancellationToken ) : Task
PackAsync ( System.UInt64 value ) : Task
PackAsync ( System.UInt64 value, CancellationToken cancellationToken ) : Task
PackAsync ( sbyte value ) : Task
PackAsync ( sbyte value, CancellationToken cancellationToken ) : Task
PrivatePackAsyncCore ( bool value, CancellationToken cancellationToken ) : Task
PrivatePackAsyncCore ( byte value, CancellationToken cancellationToken ) : Task
PrivatePackAsyncCore ( sbyte value, CancellationToken cancellationToken ) : Task
PrivatePackCore ( bool value ) : void
PrivatePackCore ( byte value ) : void
PrivatePackCore ( sbyte value ) : void
PrivatePackNullAsyncCore ( CancellationToken cancellationToken ) : Task
PrivatePackNullCore ( ) : void
ThrowArgumentNullException ( string parameterName ) : void
ThrowCannotBeNegativeException ( string parameterName ) : void
ThrowExtTypeIsProhibitedException ( ) : void
ThrowMissingBodyOfExtTypeValueException ( string parameterName ) : void
ThrowObjectDisposedException ( ) : void
TryPackTinyUnsignedInteger ( ulong value ) : bool
TryPackTinyUnsignedIntegerAsync ( ulong value ) : Task
TryPackTinyUnsignedIntegerAsync ( ulong value, CancellationToken cancellationToken ) : Task
TryPackUInt8 ( ulong value ) : bool
TryPackUInt8Async ( ulong value ) : Task
TryPackUInt8Async ( ulong value, CancellationToken cancellationToken ) : Task
VerifyNotDisposed ( ) : void
WriteBytes ( ICollection value ) : void
WriteBytes ( byte value, bool isImmutable ) : void

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

Create() публичный статический Метод

Create standard Safe Packer instancde wrapping specified Stream with DefaultCompatibilityOptions.
You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.
is null.
public static Create ( Stream stream ) : Packer
stream Stream object. This stream will be closed when is called.
Результат Packer

Create() публичный статический Метод

Create standard Safe Packer instancde wrapping specified Stream with specified PackerCompatibilityOptions.
You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.
is null.
public static Create ( Stream stream, PackerCompatibilityOptions compatibilityOptions ) : Packer
stream Stream object. This stream will be closed when is called.
compatibilityOptions PackerCompatibilityOptions A which specifies compatibility options.
Результат Packer

Create() публичный статический Метод

Create standard Safe Packer instancde wrapping specified Stream with specified PackerCompatibilityOptions.
You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.
is null.
public static Create ( Stream stream, PackerCompatibilityOptions compatibilityOptions, PackerUnpackerStreamOptions streamOptions ) : Packer
stream Stream object.
compatibilityOptions PackerCompatibilityOptions A which specifies compatibility options.
streamOptions PackerUnpackerStreamOptions which specifies stream handling options.
Результат Packer

Create() публичный статический Метод

Create standard Safe Packer instancde wrapping specified Stream with specified PackerCompatibilityOptions.
You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.
is null.
public static Create ( Stream stream, PackerCompatibilityOptions compatibilityOptions, bool ownsStream ) : Packer
stream Stream object.
compatibilityOptions PackerCompatibilityOptions A which specifies compatibility options.
ownsStream bool /// true to close when this instance is disposed; /// false, otherwise. ///
Результат Packer

Create() публичный статический Метод

Create standard Safe Packer instancde wrapping specified Stream with DefaultCompatibilityOptions.
You can specify any derived Stream class like FileStream, MemoryStream, NetworkStream, UnmanagedMemoryStream, or so.
is null.
public static Create ( Stream stream, bool ownsStream ) : Packer
stream Stream object.
ownsStream bool /// true to close when this instance is disposed; /// false, otherwise. ///
Результат Packer

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

Clean up internal resources.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

When overridden by derived class, release all unmanaged resources, optionally release managed resources.
protected Dispose ( bool disposing ) : void
disposing bool If true, release managed resources too.
Результат void

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

Flushes internal buffer (including underlying stream).
public Flush ( ) : void
Результат void

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

Flushes internal buffer (including underlying stream) asynchronously.
public FlushAsync ( ) : Task
Результат Task

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

Flushes internal buffer (including underlying stream) asynchronously.
public FlushAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Pack nullable Boolean value.
public Pack ( System.Boolean value ) : Packer
value System.Boolean Value to serialize.
Результат Packer

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

Pack nullable Byte value.
public Pack ( Byte value ) : Packer
value Byte Value to serialize.
Результат Packer

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

Pack nullable Double value.
public Pack ( Double value ) : Packer
value Double Value to serialize.
Результат Packer

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

Pack nullable Int16 value.
public Pack ( Int16 value ) : Packer
value System.Int16 Value to serialize.
Результат Packer

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

Pack nullable Int32 value.
public Pack ( Int32 value ) : Packer
value System.Int32 Value to serialize.
Результат Packer

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

Pack nullable Int64 value.
public Pack ( System.Int64 value ) : Packer
value System.Int64 Value to serialize.
Результат Packer

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

Pack nullable Single value.
public Pack ( System.Single value ) : Packer
value System.Single Value to serialize.
Результат Packer

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

Packs Boolean value to current stream.
public Pack ( bool value ) : Packer
value bool value.
Результат Packer

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

Packs Byte value to current stream.
This instance has been disposed.
public Pack ( byte value ) : Packer
value byte value.
Результат Packer

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

Pack nullable Boolean value asynchronously.
public PackAsync ( System.Boolean value ) : Task
value System.Boolean Value to serialize.
Результат Task

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

Pack nullable Boolean value asynchronously.
public PackAsync ( System.Boolean value, CancellationToken cancellationToken ) : Task
value System.Boolean Value to serialize.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Pack nullable Byte value asynchronously.
public PackAsync ( Byte value ) : Task
value Byte Value to serialize.
Результат Task

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

Pack nullable Byte value asynchronously.
public PackAsync ( Byte value, CancellationToken cancellationToken ) : Task
value Byte Value to serialize.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Pack nullable Double value asynchronously.
public PackAsync ( Double value ) : Task
value Double Value to serialize.
Результат Task

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

Pack nullable Double value asynchronously.
public PackAsync ( Double value, CancellationToken cancellationToken ) : Task
value Double Value to serialize.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Pack nullable Int16 value asynchronously.
public PackAsync ( Int16 value ) : Task
value System.Int16 Value to serialize.
Результат Task

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

Pack nullable Int16 value asynchronously.
public PackAsync ( Int16 value, CancellationToken cancellationToken ) : Task
value System.Int16 Value to serialize.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Pack nullable Int32 value asynchronously.
public PackAsync ( Int32 value ) : Task
value System.Int32 Value to serialize.
Результат Task

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

Pack nullable Int32 value asynchronously.
public PackAsync ( Int32 value, CancellationToken cancellationToken ) : Task
value System.Int32 Value to serialize.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Pack nullable Int64 value asynchronously.
public PackAsync ( System.Int64 value ) : Task
value System.Int64 Value to serialize.
Результат Task

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

Pack nullable Int64 value asynchronously.
public PackAsync ( System.Int64 value, CancellationToken cancellationToken ) : Task
value System.Int64 Value to serialize.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Pack nullable Single value asynchronously.
public PackAsync ( System.Single value ) : Task
value System.Single Value to serialize.
Результат Task

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

Pack nullable Single value asynchronously.
public PackAsync ( System.Single value, CancellationToken cancellationToken ) : Task
value System.Single Value to serialize.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Packs Boolean value to current stream asynchronously.
public PackAsync ( bool value ) : Task
value bool value.
Результат Task

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

Packs Boolean value to current stream asynchronously.
public PackAsync ( bool value, CancellationToken cancellationToken ) : Task
value bool value.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Packs Byte value to current stream asynchronously.
This instance has been disposed.
public PackAsync ( byte value ) : Task
value byte value.
Результат Task

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

Packs Byte value to current stream asynchronously.
This instance has been disposed.
public PackAsync ( byte value, CancellationToken cancellationToken ) : Task
value byte value.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

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

Packs a null value to current stream.
This instance has been disposed.
public PackNull ( ) : Packer
Результат Packer

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

Packs a null value to current stream asynchronously.
This instance has been disposed.
public PackNullAsync ( ) : Task
Результат Task

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

Packs a null value to current stream asynchronously.
This instance has been disposed.
public PackNullAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

Packer() защищенный Метод

Initializes a new instance of the Packer class with DefaultCompatibilityOptions.
protected Packer ( ) : System
Результат System

Packer() защищенный Метод

Initializes a new instance of the Packer class with specified PackerCompatibilityOptions.
protected Packer ( PackerCompatibilityOptions compatibilityOptions ) : System
compatibilityOptions PackerCompatibilityOptions A which specifies compatibility options.
Результат System

SeekTo() защищенный Метод

When overridden by derived class, change current position to specified offset.
/// A class of this instance does not support seek. ///
protected SeekTo ( long offset ) : void
offset long Offset. You shoud not specify the value which causes underflow or overflow.
Результат void

TryPackInt8() защищенный Метод

Try packs SByte value to current stream strictly.
protected TryPackInt8 ( long value ) : bool
value long Maybe value.
Результат bool

TryPackInt8Async() защищенный Метод

Try packs SByte value to current stream strictly asynchronously.
protected TryPackInt8Async ( long value ) : Task
value long Maybe value.
Результат Task

TryPackInt8Async() защищенный Метод

Try packs SByte value to current stream strictly asynchronously.
protected TryPackInt8Async ( long value, CancellationToken cancellationToken ) : Task
value long Maybe value.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

TryPackTinySignedInteger() защищенный Метод

Try packs SByte value to current stream as tiny fix num.
protected TryPackTinySignedInteger ( long value ) : bool
value long Maybe tiny value.
Результат bool

TryPackTinySignedIntegerAsync() защищенный Метод

Try packs SByte value to current stream as tiny fix num asynchronously.
protected TryPackTinySignedIntegerAsync ( long value ) : Task
value long Maybe tiny value.
Результат Task

TryPackTinySignedIntegerAsync() защищенный Метод

Try packs SByte value to current stream as tiny fix num asynchronously.
protected TryPackTinySignedIntegerAsync ( long value, CancellationToken cancellationToken ) : Task
value long Maybe tiny value.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

WriteByte() защищенный абстрактный Метод

When overridden by derived class, writes specified byte to stream using implementation specific manner.
protected abstract WriteByte ( byte value ) : void
value byte A byte to be written.
Результат void

WriteByteAsync() защищенный Метод

When overridden by derived class, writes specified byte to stream using implementation specific manner asynchronously.
protected WriteByteAsync ( byte value ) : Task
value byte A byte to be written.
Результат Task

WriteByteAsync() защищенный Метод

When overridden by derived class, writes specified byte to stream using implementation specific manner asynchronously.
protected WriteByteAsync ( byte value, CancellationToken cancellationToken ) : Task
value byte A byte to be written.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

WriteBytesAsync() защищенный Метод

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.
protected WriteBytesAsync ( ICollection value ) : Task
value ICollection Collection of bytes to be written.
Результат Task

WriteBytesAsync() защищенный Метод

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.
protected WriteBytesAsync ( ICollection value, CancellationToken cancellationToken ) : Task
value ICollection Collection of bytes to be written.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task

WriteBytesAsync() защищенный Метод

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.
protected WriteBytesAsync ( byte value, bool isImmutable ) : Task
value byte Bytes to be written.
isImmutable bool If the can be treat as immutable (that is, can be used safely without copying) then true.
Результат Task

WriteBytesAsync() защищенный Метод

Writes specified bytes to stream using implementation specific most efficient manner asynchronously.
protected WriteBytesAsync ( byte value, bool isImmutable, CancellationToken cancellationToken ) : Task
value byte Bytes to be written.
isImmutable bool If the can be treat as immutable (that is, can be used safely without copying) then true.
cancellationToken System.Threading.CancellationToken The token to monitor for cancellation requests. The default value is .
Результат Task