Struct DataStreamWriter
Syntax
public struct DataStreamWriter
Constructors
DataStreamWriter(Byte*, Int32)
Initializes a new instance of the DataStreamWriter struct with a memory we don't own
Declaration
public DataStreamWriter(byte *data, int length)
Parameters
Type |
Name |
Description |
Byte* |
data |
Pointer to the data
|
Int32 |
length |
Length of the data
|
DataStreamWriter(Int32, Allocator)
Initializes a new instance of the DataStreamWriter struct.
Declaration
public DataStreamWriter(int length, Allocator allocator)
Parameters
Type |
Name |
Description |
Int32 |
length |
The length of the buffer.
|
Allocator |
allocator |
The Allocator used to allocate the memory.
|
DataStreamWriter(NativeArray<Byte>)
Initializes a new instance of the DataStreamWriter struct with a NativeArray{byte}
Declaration
public DataStreamWriter(NativeArray<byte> data)
Parameters
Type |
Name |
Description |
NativeArray<Byte> |
data |
The buffer we want to attach to our DataStreamWriter.
|
Properties
Capacity
The total size of the data buffer, see Length for
the size of space used in the buffer.
Declaration
public readonly int Capacity { get; }
Property Value
HasFailedWrites
Declaration
public readonly bool HasFailedWrites { get; }
Property Value
IsCreated
True if there is a valid data buffer present. This would be false
if the writer was created with no arguments.
Declaration
public readonly bool IsCreated { get; }
Property Value
IsLittleEndian
Declaration
public static readonly bool IsLittleEndian { get; }
Property Value
Length
The size of the buffer used. See Capacity for the total size.
Declaration
public readonly int Length { get; }
Property Value
LengthInBits
The size of the buffer used in bits. See Length for the length in bytes.
Declaration
public readonly int LengthInBits { get; }
Property Value
Methods
AsNativeArray()
Declaration
public NativeArray<byte> AsNativeArray()
Returns
Clear()
Moves the write position to the start of the data buffer used.
Declaration
Flush()
Declaration
WriteByte(Byte)
Declaration
public bool WriteByte(byte value)
Parameters
Type |
Name |
Description |
Byte |
value |
|
Returns
WriteBytes(Byte*, Int32)
Declaration
public bool WriteBytes(byte *data, int bytes)
Parameters
Returns
WriteBytes(NativeArray<Byte>)
Copy NativeArray of bytes into the writers data buffer.
Declaration
public bool WriteBytes(NativeArray<byte> value)
Parameters
Returns
WriteFixedString128(FixedString128Bytes)
Declaration
public bool WriteFixedString128(FixedString128Bytes str)
Parameters
Returns
WriteFixedString32(FixedString32Bytes)
Declaration
public bool WriteFixedString32(FixedString32Bytes str)
Parameters
Returns
WriteFixedString4096(FixedString4096Bytes)
Declaration
public bool WriteFixedString4096(FixedString4096Bytes str)
Parameters
Returns
WriteFixedString512(FixedString512Bytes)
Declaration
public bool WriteFixedString512(FixedString512Bytes str)
Parameters
Returns
WriteFixedString64(FixedString64Bytes)
Declaration
public bool WriteFixedString64(FixedString64Bytes str)
Parameters
Returns
WriteFloat(Single)
Declaration
public bool WriteFloat(float value)
Parameters
Type |
Name |
Description |
Single |
value |
|
Returns
WriteInt(Int32)
Declaration
public bool WriteInt(int value)
Parameters
Type |
Name |
Description |
Int32 |
value |
|
Returns
WriteIntNetworkByteOrder(Int32)
Declaration
public bool WriteIntNetworkByteOrder(int value)
Parameters
Type |
Name |
Description |
Int32 |
value |
|
Returns
WriteLong(Int64)
Declaration
public bool WriteLong(long value)
Parameters
Type |
Name |
Description |
Int64 |
value |
|
Returns
WritePackedFixedString128Delta(FixedString128Bytes, FixedString128Bytes, NetworkCompressionModel)
Declaration
public bool WritePackedFixedString128Delta(FixedString128Bytes str, FixedString128Bytes baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedFixedString32Delta(FixedString32Bytes, FixedString32Bytes, NetworkCompressionModel)
Declaration
public bool WritePackedFixedString32Delta(FixedString32Bytes str, FixedString32Bytes baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedFixedString4096Delta(FixedString4096Bytes, FixedString4096Bytes, NetworkCompressionModel)
Declaration
public bool WritePackedFixedString4096Delta(FixedString4096Bytes str, FixedString4096Bytes baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedFixedString512Delta(FixedString512Bytes, FixedString512Bytes, NetworkCompressionModel)
Declaration
public bool WritePackedFixedString512Delta(FixedString512Bytes str, FixedString512Bytes baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedFixedString64Delta(FixedString64Bytes, FixedString64Bytes, NetworkCompressionModel)
Declaration
public bool WritePackedFixedString64Delta(FixedString64Bytes str, FixedString64Bytes baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedFloat(Single, NetworkCompressionModel)
Declaration
public bool WritePackedFloat(float value, NetworkCompressionModel model)
Parameters
Returns
WritePackedFloatDelta(Single, Single, NetworkCompressionModel)
Declaration
public bool WritePackedFloatDelta(float value, float baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedInt(Int32, NetworkCompressionModel)
Declaration
public bool WritePackedInt(int value, NetworkCompressionModel model)
Parameters
Returns
WritePackedIntDelta(Int32, Int32, NetworkCompressionModel)
Declaration
public bool WritePackedIntDelta(int value, int baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedLong(Int64, NetworkCompressionModel)
Declaration
public bool WritePackedLong(long value, NetworkCompressionModel model)
Parameters
Returns
WritePackedLongDelta(Int64, Int64, NetworkCompressionModel)
Declaration
public bool WritePackedLongDelta(long value, long baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedUInt(UInt32, NetworkCompressionModel)
Declaration
public bool WritePackedUInt(uint value, NetworkCompressionModel model)
Parameters
Returns
WritePackedUIntDelta(UInt32, UInt32, NetworkCompressionModel)
Declaration
public bool WritePackedUIntDelta(uint value, uint baseline, NetworkCompressionModel model)
Parameters
Returns
WritePackedULong(UInt64, NetworkCompressionModel)
Declaration
public bool WritePackedULong(ulong value, NetworkCompressionModel model)
Parameters
Returns
WritePackedULongDelta(UInt64, UInt64, NetworkCompressionModel)
Declaration
public bool WritePackedULongDelta(ulong value, ulong baseline, NetworkCompressionModel model)
Parameters
Returns
WriteRawBits(UInt32, Int32)
Declaration
public bool WriteRawBits(uint value, int numbits)
Parameters
Returns
WriteShort(Int16)
Declaration
public bool WriteShort(short value)
Parameters
Type |
Name |
Description |
Int16 |
value |
|
Returns
WriteShortNetworkByteOrder(Int16)
Declaration
public bool WriteShortNetworkByteOrder(short value)
Parameters
Type |
Name |
Description |
Int16 |
value |
|
Returns
WriteUInt(UInt32)
Declaration
public bool WriteUInt(uint value)
Parameters
Type |
Name |
Description |
UInt32 |
value |
|
Returns
WriteUIntNetworkByteOrder(UInt32)
Declaration
public bool WriteUIntNetworkByteOrder(uint value)
Parameters
Type |
Name |
Description |
UInt32 |
value |
|
Returns
WriteULong(UInt64)
Declaration
public bool WriteULong(ulong value)
Parameters
Type |
Name |
Description |
UInt64 |
value |
|
Returns
WriteUShort(UInt16)
Declaration
public bool WriteUShort(ushort value)
Parameters
Type |
Name |
Description |
UInt16 |
value |
|
Returns
WriteUShortNetworkByteOrder(UInt16)
Declaration
public bool WriteUShortNetworkByteOrder(ushort value)
Parameters
Type |
Name |
Description |
UInt16 |
value |
|
Returns
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.