Unpacker Class |
Namespace: MsgPack
The Unpacker type exposes the following members.
Name | Description | |
---|---|---|
Data | Obsolete.
Gets a last unpacked data.
| |
IsArrayHeader |
Gets a value indicating whether this instance is positioned to array header.
| |
IsCollectionHeader |
Gets a value indicating whether this instance is positioned to array or map header.
| |
IsMapHeader |
Gets a value indicating whether this instance is positioned to map header.
| |
ItemsCount |
Gets the items count for current array or map.
| |
LastReadData |
Gets a last unpacked data.
| |
UnderlyingStream |
Gets the underlying stream to handle direct API.
|
Name | Description | |
---|---|---|
Create(Stream) |
Creates the new Unpacker from specified stream.
| |
Create(Stream, Boolean) |
Creates the new Unpacker from specified stream.
| |
Dispose |
Releases all managed resources.
| |
Dispose(Boolean) |
Releases unmanaged and optionally managed resources.
| |
EndReadSubtree |
Ends the read subtree.
| |
GetEnumerator |
Gets IEnumeratorT to enumerate MessagePackObject from source stream.
| |
Read |
Reads next Message Pack entry.
| |
ReadArrayLength |
Reads next array length value from current stream.
| |
ReadBinary |
Reads next byte array value from current stream.
| |
ReadBoolean |
Reads next Boolean value from current stream.
| |
ReadByte |
Reads next Byte value from current stream.
| |
ReadCore |
Reads next Message Pack entry.
| |
ReadDouble |
Reads next Double value from current stream.
| |
ReadInt16 |
Reads next Int16 value from current stream.
| |
ReadInt32 |
Reads next Int32 value from current stream.
| |
ReadInt64 |
Reads next Int64 value from current stream.
| |
ReadItem |
Gets a current item or collection as single MessagePackObject from the stream.
| |
ReadItemData |
Gets a current item or collection as single MessagePackObject from the stream.
| |
ReadMapLength |
Reads next map length value from current stream.
| |
ReadMessagePackExtendedTypeObject |
Reads next MessagePackExtendedTypeObject value from current stream.
| |
ReadNullableBoolean |
Reads next nullable Boolean value from current stream.
| |
ReadNullableByte |
Reads next nullable Byte value from current stream.
| |
ReadNullableDouble |
Reads next nullable Double value from current stream.
| |
ReadNullableInt16 |
Reads next nullable Int16 value from current stream.
| |
ReadNullableInt32 |
Reads next nullable Int32 value from current stream.
| |
ReadNullableInt64 |
Reads next nullable Int64 value from current stream.
| |
ReadNullableMessagePackExtendedTypeObject |
Reads next nullable MessagePackExtendedTypeObject value from current stream.
| |
ReadNullableSByte |
Reads next nullable SByte value from current stream.
| |
ReadNullableSingle |
Reads next nullable Single value from current stream.
| |
ReadNullableUInt16 |
Reads next nullable UInt16 value from current stream.
| |
ReadNullableUInt32 |
Reads next nullable UInt32 value from current stream.
| |
ReadNullableUInt64 |
Reads next nullable UInt64 value from current stream.
| |
ReadObject |
Reads next value from current stream.
| |
ReadSByte |
Reads next SByte value from current stream.
| |
ReadSingle |
Reads next Single value from current stream.
| |
ReadString |
Reads next utf-8 encoded string value from current stream.
| |
ReadSubtree |
Starts unpacking of current subtree.
| |
ReadSubtreeCore |
Starts unpacking of current subtree.
| |
ReadUInt16 |
Reads next UInt16 value from current stream.
| |
ReadUInt32 |
Reads next UInt32 value from current stream.
| |
ReadUInt64 |
Reads next UInt64 value from current stream.
| |
Skip |
Skips the subtree where the root is the current entry, and returns skipped byte length.
| |
SkipCore |
Skips the subtree where the root is the current entry, and returns skipped byte length.
| |
UnpackSubtree |
Unpacks current subtree and returns subtree root as array or map.
| |
UnpackSubtreeData |
Unpacks current subtree and returns subtree root as array or map.
|
Name | Description | |
---|---|---|
UnpackT | Overloaded.
Unpacks specified type value with the default context.
(Defined by PackerUnpackerExtensions.) | |
UnpackT(SerializationContext) | Overloaded.
Unpacks specified type value with the specified context.
(Defined by PackerUnpackerExtensions.) |
Streaming
When the Read is called, unpacker go into 'Streaming' mode. In this mode, unpacker unpacks individual entries as MessagePackObject via Data property. If the underlying stream is ended unexpectedly, then Read returns false, and Data will be null. Note that if the underlying stream is feeded, that is the Length is expanded and its Position is not forwarded, subsequent Read invocation will success, and Data is set as complete entry which reflects feeded binary.
If the reading of the entry is completed, that is the Data is not null, unpacker can transit other mode.
Enumerating
When the GetEnumerator is called and the enumeration is started, unpacker go into 'Enumerating' mode. In this mode, unpacker unpacks individual entries as MessagePackObject via Current property. If the underlying stream is ended unexpectedly, enumeration is interrupted. The interrupted unpacker cannot be resume.
Once the enumeration is completed gracefully, unpacker can transit other mode.
Skipping
When the Skip is called, unpacker go into 'Skipping' mode. In this mode, unpacker scans the subtree where the root is current item, then returns skipped byte length. If the underlying stream is ended unexpectedly, it returns null. Note that if the underlying stream is feeded, that is the Length is expanded and its Position is not forwarded, subsequent Skip invocation will success, and returns length as complete entry which reflects feeded binary.
Note |
---|
If the underlying Stream is cannot be seeked (that is, CanSeek is false), DO NOT use this method. You can buffering the content via MemoryStream instead, for example. |
If the skipping of the subtree is completed, that is the return value is not null, unpacker can transit other mode.
Subtree
When the ReadSubtree is called, unpacker go into 'Subtree' mode. In this mode, any operation for this unpacker instance is invalid. Instead of use this instance itself, you can use subtree unpacker returned from ReadSubtree. The subtree unpacker is the instance which scope is limited to the subtree where the root is the current entry when ReadSubtree is called. The subtree unpacker also have its own mode and state.
Note |
---|
Dispose of the subtree unpacker must be called to indicate subtree unpacking is gracefully completed. When the extra entries are remained in the subtree, these will be skipped on the disposal process. |
Once the subtree unpacking is completed gracefully, that is, Dispose on the subtree unpacker called, the parant unpacker can transit other mode.