Class MsgPackWriter
Rudimentary Msgpack implementation that will be used for sending RPC to the server.
Assembly: cs.temp.dll.dll
Implements:
OdinNative.Utils.MessagePack.IMsgPackWriter, Odin.IDisposable
Properties
Encoding
Used Encoding defaults to UTF8
LittleEndianness
Indicates the value byte order
Methods
Clear()
Clear stream buffer
Create(byte[])
Create writer with a prefilled stream buffer
Returns
OdinNative.Utils.MessagePack.MsgPackWriter: writer
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | data that will be pushed into the stream |
Create(byte[], Encoding)
Returns
OdinNative.Utils.MessagePack.MsgPackWriter
Parameters
Type | Name |
---|---|
System.Byte[] | bytes |
Odin.Encoding | encoding |
Write(uint)
Set MsgPackToken based on the unsigend value size
Returns
System.Int32
: size written
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | value | value to write and identify size |
Write(int)
Set MsgPackToken based on the sigend value size
Returns
System.Int32
: size written
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | value to write and identify size |
WriteByte(byte)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Uint8
Parameters
Type | Name |
---|---|
System.Byte | value |
WriteSByte(sbyte)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Int8
Parameters
Type | Name |
---|---|
System.SByte | value |
WriteShortValue(short, bool)
Parameters
Type | Name |
---|---|
System.Int16 | value |
System.Boolean | isLittleEndian |
WriteUShortValue(ushort, bool)
Parameters
Type | Name |
---|---|
System.UInt16 | value |
System.Boolean | isLittleEndian |
WriteFloatValue(float, bool)
Parameters
Type | Name |
---|---|
System.Single | value |
System.Boolean | isLittleEndian |
WriteDoubleValue(double, bool)
Parameters
Type | Name |
---|---|
System.Double | value |
System.Boolean | isLittleEndian |
WriteIntValue(int, bool)
Parameters
Type | Name |
---|---|
System.Int32 | value |
System.Boolean | isLittleEndian |
WriteUIntValue(uint, bool)
Parameters
Type | Name |
---|---|
System.UInt32 | value |
System.Boolean | isLittleEndian |
WriteLongValue(long, bool)
Parameters
Type | Name |
---|---|
System.Int64 | value |
System.Boolean | isLittleEndian |
WriteULongValue(ulong, bool)
Parameters
Type | Name |
---|---|
System.UInt64 | value |
System.Boolean | isLittleEndian |
WriteShort(short)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Int16
Parameters
Type | Name |
---|---|
System.Int16 | value |
WriteUShort(ushort)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Uint16
Parameters
Type | Name |
---|---|
System.UInt16 | value |
WriteInt(int)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Int32
Parameters
Type | Name |
---|---|
System.Int32 | value |
WriteUInt(uint)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Uint32
Parameters
Type | Name |
---|---|
System.UInt32 | value |
WriteLong(long)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Int64
Parameters
Type | Name |
---|---|
System.Int64 | value |
WriteULong(ulong)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Uint64
Parameters
Type | Name |
---|---|
System.UInt64 | value |
WriteFloat(float)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Float32
Parameters
Type | Name |
---|---|
System.Single | value |
WriteDouble(double)
Write value with token OdinNative.Utils.MessagePack.MsgPackToken.Float64
Parameters
Type | Name |
---|---|
System.Double | value |
WriteBool(bool)
Write fixedbool of either OdinNative.Utils.MessagePack.MsgPackToken.True or OdinNative.Utils.MessagePack.MsgPackToken.False
Parameters
Type | Name |
---|---|
System.Boolean | value |
WriteString(string)
Write string with writer encoding (default UTF8)
Returns
System.Int32
: size written
Parameters
Type | Name |
---|---|
System.String | value |
WriteString(string, Encoding)
MessagePack header is big-endian, value binarywriter default little-endian
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.String | value |
Odin.Encoding | encoding |
WriteBinary(byte[])
MessagePack header is big-endian, value binarywriter default little-endian
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.Byte[] | value |
WriteArrayHeader(uint)
MessagePack header is big-endian, value binarywriter default little-endian
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.UInt32 | count |
WriteMapHeader(uint)
MessagePack header is big-endian value binarywriter default little-endian
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.UInt32 | count |
GetBytes()
Get raw bytes from the stream buffer
Returns
System.Byte[]
: Msgpack bytes### GetLength()
Get raw bytes from the stream buffer
Returns
System.Int64
: Msgpack buffer length### GetBuffer(out ArraySegment<byte>)
Get raw bytes from the underlying stream buffer
Returns
System.Boolean
: true on success or false
Parameters
Type | Name | Description |
---|---|---|
Odin.ArraySegment<System.Byte> | buffer | underlying stream buffer |
Append(byte[])
Append bytes to the stream at the currrent stream position
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | bytes to write |
ToString()
String representation of the stream based on encoding (default UTF8)
Returns
System.String
: string of stream### ToHex()
String representation of the stream in hex
Returns
System.String
: hex string of stream### Dispose(bool)
Parameters
Type | Name |
---|---|
System.Boolean | disposing |
Dispose()
dispose
WriteByte(ref List<byte>, byte)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Uint8 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Byte | value |
WriteSByte(ref List<byte>, sbyte)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Int8 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.SByte | value |
WriteShort(ref List<byte>, short)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Int16 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Int16 | value |
WriteUShort(ref List<byte>, ushort)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Uint16 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.UInt16 | value |
WriteInt(ref List<byte>, int)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Int32 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Int32 | value |
WriteUInt(ref List<byte>, uint)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Uint32 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.UInt32 | value |
WriteLong(ref List<byte>, long)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Int64 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Int64 | value |
WriteULong(ref List<byte>, ulong)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Uint64 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.UInt64 | value |
WriteFloat(ref List<byte>, float)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Float32 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Single | value |
WriteDouble(ref List<byte>, double)
Append value with OdinNative.Utils.MessagePack.MsgPackToken.Float64 token to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Double | value |
WriteBool(ref List<byte>, bool)
Append fixedbool with either OdinNative.Utils.MessagePack.MsgPackToken.True or OdinNative.Utils.MessagePack.MsgPackToken.False to bytes
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Boolean | value |
WriteString(ref List<byte>, string, Encoding)
Append string value with size based token to bytes
Returns
System.Int32
: size written
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.String | value |
Odin.Encoding | encoding |
WriteBinary(ref List<byte>, byte[])
Append values with size based token to bytes
Returns
System.Int32
Parameters
Type | Name |
---|---|
Odin.List<System.Byte> | bytes |
System.Byte[] | value |
Implements
- OdinNative.Utils.MessagePack.IMsgPackWriter
Odin.IDisposable