Struct DataStreamReader
The DataStreamReader
class is the counterpart of the
DataStreamWriter
class and can be be used to deserialize
data which was prepared with it.
Syntax
public struct DataStreamReader
Constructors
DataStreamReader(NativeSlice<Byte>)
Declaration
public DataStreamReader(NativeSlice<byte> slice)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
slice |
|
DataStreamReader(DataStreamWriter, Int32, Int32)
Declaration
public DataStreamReader(DataStreamWriter writer, int offset, int length)
Parameters
Properties
IsCreated
True if the reader has been pointed to a valid buffer space. This
would be false if the reader was created with no arguments.
Declaration
public bool IsCreated { get; }
Property Value
Length
The total size of the buffer space this reader is working with.
Declaration
public int Length { get; }
Property Value
Methods
GetBitsRead(ref DataStreamReader.Context)
Declaration
public int GetBitsRead(ref DataStreamReader.Context ctx)
Parameters
Returns
GetBytesRead(ref DataStreamReader.Context)
Declaration
public int GetBytesRead(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadByte(ref DataStreamReader.Context)
Declaration
public byte ReadByte(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadBytes(ref DataStreamReader.Context, Byte*, Int32)
Read and copy data to the memory location pointed to, an exception will
be thrown if it does not fit.
Declaration
public void ReadBytes(ref DataStreamReader.Context ctx, byte *data, int length)
Parameters
Exceptions
Type |
Condition |
ArgumentOutOfRangeException |
Thrown if the length
will put the reader out of bounds based on the current read pointer
position.
|
ReadBytesAsArray(ref DataStreamReader.Context, Int32)
Create a new byte array and read the given length of bytes into it.
Declaration
public byte[] ReadBytesAsArray(ref DataStreamReader.Context ctx, int length)
Parameters
Returns
Type |
Description |
Byte[] |
Newly created byte array with the contents.
|
ReadBytesIntoArray(ref DataStreamReader.Context, ref Byte[], Int32)
Read and copy data into the given managed byte array, an exception will
be thrown if it does not fit.
Declaration
public void ReadBytesIntoArray(ref DataStreamReader.Context ctx, ref byte[] dest, int length)
Parameters
ReadFloat(ref DataStreamReader.Context)
Declaration
public float ReadFloat(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadInt(ref DataStreamReader.Context)
Declaration
public int ReadInt(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadIntNetworkByteOrder(ref DataStreamReader.Context)
Declaration
public int ReadIntNetworkByteOrder(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadPackedFloat(ref DataStreamReader.Context, NetworkCompressionModel)
Declaration
public float ReadPackedFloat(ref DataStreamReader.Context ctx, NetworkCompressionModel model)
Parameters
Returns
ReadPackedFloatDelta(ref DataStreamReader.Context, Single, NetworkCompressionModel)
Declaration
public float ReadPackedFloatDelta(ref DataStreamReader.Context ctx, float baseline, NetworkCompressionModel model)
Parameters
Returns
ReadPackedInt(ref DataStreamReader.Context, NetworkCompressionModel)
Declaration
public int ReadPackedInt(ref DataStreamReader.Context ctx, NetworkCompressionModel model)
Parameters
Returns
ReadPackedIntDelta(ref DataStreamReader.Context, Int32, NetworkCompressionModel)
Declaration
public int ReadPackedIntDelta(ref DataStreamReader.Context ctx, int baseline, NetworkCompressionModel model)
Parameters
Returns
ReadPackedStringDelta(ref DataStreamReader.Context, NativeString64, NetworkCompressionModel)
Declaration
public NativeString64 ReadPackedStringDelta(ref DataStreamReader.Context ctx, NativeString64 baseline, NetworkCompressionModel model)
Parameters
Returns
Type |
Description |
NativeString64 |
|
ReadPackedUInt(ref DataStreamReader.Context, NetworkCompressionModel)
Declaration
public uint ReadPackedUInt(ref DataStreamReader.Context ctx, NetworkCompressionModel model)
Parameters
Returns
ReadPackedUIntDelta(ref DataStreamReader.Context, UInt32, NetworkCompressionModel)
Declaration
public uint ReadPackedUIntDelta(ref DataStreamReader.Context ctx, uint baseline, NetworkCompressionModel model)
Parameters
Returns
ReadShort(ref DataStreamReader.Context)
Declaration
public short ReadShort(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadShortNetworkByteOrder(ref DataStreamReader.Context)
Declaration
public short ReadShortNetworkByteOrder(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadString(ref DataStreamReader.Context)
Declaration
public NativeString64 ReadString(ref DataStreamReader.Context ctx)
Parameters
Returns
Type |
Description |
NativeString64 |
|
ReadUInt(ref DataStreamReader.Context)
Declaration
public uint ReadUInt(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadUIntNetworkByteOrder(ref DataStreamReader.Context)
Declaration
public uint ReadUIntNetworkByteOrder(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadULong(ref DataStreamReader.Context)
Declaration
public ulong ReadULong(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadUShort(ref DataStreamReader.Context)
Declaration
public ushort ReadUShort(ref DataStreamReader.Context ctx)
Parameters
Returns
ReadUShortNetworkByteOrder(ref DataStreamReader.Context)
Declaration
public ushort ReadUShortNetworkByteOrder(ref DataStreamReader.Context ctx)
Parameters
Returns
Extension Methods
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.