Struct DataStreamWriter | Unity Transport | 0.5.0-preview.5
docs.unity3d.com
    Show / Hide Table of Contents

    Struct DataStreamWriter

    Namespace: Unity.Networking.Transport
    Syntax
    public struct DataStreamWriter

    Constructors

    DataStreamWriter(Int32, Allocator)

    Declaration
    public DataStreamWriter(int length, Allocator allocator)
    Parameters
    Type Name Description
    Int32 length
    Allocator allocator

    DataStreamWriter(NativeArray<Byte>)

    Declaration
    public DataStreamWriter(NativeArray<byte> data)
    Parameters
    Type Name Description
    NativeArray<Byte> data

    Properties

    Capacity

    The total size of the data buffer, see Length for the size of space used in the buffer.

    Declaration
    public int Capacity { get; }
    Property Value
    Type Description
    Int32

    HasFailedWrites

    Declaration
    public bool HasFailedWrites { get; }
    Property Value
    Type Description
    Boolean

    IsCreated

    True if there is a valid data buffer present. This would be false if the writer was created with no arguments.

    Declaration
    public bool IsCreated { get; }
    Property Value
    Type Description
    Boolean

    Length

    The size of the buffer used. See Capacity for the total size.

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    Int32

    LengthInBits

    The size of the buffer used in bits. See Length for the length in bytes.

    Declaration
    public int LengthInBits { get; }
    Property Value
    Type Description
    Int32

    Methods

    AsNativeArray()

    Declaration
    public NativeArray<byte> AsNativeArray()
    Returns
    Type Description
    NativeArray<Byte>

    Clear()

    Moves the write position to the start of the data buffer used.

    Declaration
    public void Clear()

    Flush()

    Declaration
    public void Flush()

    WriteByte(Byte)

    Declaration
    public bool WriteByte(byte value)
    Parameters
    Type Name Description
    Byte value
    Returns
    Type Description
    Boolean

    WriteBytes(Byte*, Int32)

    Declaration
    public bool WriteBytes(byte *data, int bytes)
    Parameters
    Type Name Description
    Byte* data
    Int32 bytes
    Returns
    Type Description
    Boolean

    WriteBytes(NativeArray<Byte>)

    Copy NativeArray of bytes into the writers data buffer.

    Declaration
    public bool WriteBytes(NativeArray<byte> value)
    Parameters
    Type Name Description
    NativeArray<Byte> value

    Source byte array

    Returns
    Type Description
    Boolean

    WriteFixedString128(FixedString128)

    Declaration
    public bool WriteFixedString128(FixedString128 str)
    Parameters
    Type Name Description
    FixedString128 str
    Returns
    Type Description
    Boolean

    WriteFixedString32(FixedString32)

    Declaration
    public bool WriteFixedString32(FixedString32 str)
    Parameters
    Type Name Description
    FixedString32 str
    Returns
    Type Description
    Boolean

    WriteFixedString4096(FixedString4096)

    Declaration
    public bool WriteFixedString4096(FixedString4096 str)
    Parameters
    Type Name Description
    FixedString4096 str
    Returns
    Type Description
    Boolean

    WriteFixedString512(FixedString512)

    Declaration
    public bool WriteFixedString512(FixedString512 str)
    Parameters
    Type Name Description
    FixedString512 str
    Returns
    Type Description
    Boolean

    WriteFixedString64(FixedString64)

    Declaration
    public bool WriteFixedString64(FixedString64 str)
    Parameters
    Type Name Description
    FixedString64 str
    Returns
    Type Description
    Boolean

    WriteFloat(Single)

    Declaration
    public bool WriteFloat(float value)
    Parameters
    Type Name Description
    Single value
    Returns
    Type Description
    Boolean

    WriteInt(Int32)

    Declaration
    public bool WriteInt(int value)
    Parameters
    Type Name Description
    Int32 value
    Returns
    Type Description
    Boolean

    WriteIntNetworkByteOrder(Int32)

    Declaration
    public bool WriteIntNetworkByteOrder(int value)
    Parameters
    Type Name Description
    Int32 value
    Returns
    Type Description
    Boolean

    WritePackedFixedString128Delta(FixedString128, FixedString128, NetworkCompressionModel)

    Declaration
    public bool WritePackedFixedString128Delta(FixedString128 str, FixedString128 baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    FixedString128 str
    FixedString128 baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedFixedString32Delta(FixedString32, FixedString32, NetworkCompressionModel)

    Declaration
    public bool WritePackedFixedString32Delta(FixedString32 str, FixedString32 baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    FixedString32 str
    FixedString32 baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedFixedString4096Delta(FixedString4096, FixedString4096, NetworkCompressionModel)

    Declaration
    public bool WritePackedFixedString4096Delta(FixedString4096 str, FixedString4096 baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    FixedString4096 str
    FixedString4096 baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedFixedString512Delta(FixedString512, FixedString512, NetworkCompressionModel)

    Declaration
    public bool WritePackedFixedString512Delta(FixedString512 str, FixedString512 baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    FixedString512 str
    FixedString512 baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedFixedString64Delta(FixedString64, FixedString64, NetworkCompressionModel)

    Declaration
    public bool WritePackedFixedString64Delta(FixedString64 str, FixedString64 baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    FixedString64 str
    FixedString64 baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedFloat(Single, NetworkCompressionModel)

    Declaration
    public bool WritePackedFloat(float value, NetworkCompressionModel model)
    Parameters
    Type Name Description
    Single value
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedFloatDelta(Single, Single, NetworkCompressionModel)

    Declaration
    public bool WritePackedFloatDelta(float value, float baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    Single value
    Single baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedInt(Int32, NetworkCompressionModel)

    Declaration
    public bool WritePackedInt(int value, NetworkCompressionModel model)
    Parameters
    Type Name Description
    Int32 value
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedIntDelta(Int32, Int32, NetworkCompressionModel)

    Declaration
    public bool WritePackedIntDelta(int value, int baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    Int32 value
    Int32 baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedUInt(UInt32, NetworkCompressionModel)

    Declaration
    public bool WritePackedUInt(uint value, NetworkCompressionModel model)
    Parameters
    Type Name Description
    UInt32 value
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WritePackedUIntDelta(UInt32, UInt32, NetworkCompressionModel)

    Declaration
    public bool WritePackedUIntDelta(uint value, uint baseline, NetworkCompressionModel model)
    Parameters
    Type Name Description
    UInt32 value
    UInt32 baseline
    NetworkCompressionModel model
    Returns
    Type Description
    Boolean

    WriteShort(Int16)

    Declaration
    public bool WriteShort(short value)
    Parameters
    Type Name Description
    Int16 value
    Returns
    Type Description
    Boolean

    WriteShortNetworkByteOrder(Int16)

    Declaration
    public bool WriteShortNetworkByteOrder(short value)
    Parameters
    Type Name Description
    Int16 value
    Returns
    Type Description
    Boolean

    WriteUInt(UInt32)

    Declaration
    public bool WriteUInt(uint value)
    Parameters
    Type Name Description
    UInt32 value
    Returns
    Type Description
    Boolean

    WriteUIntNetworkByteOrder(UInt32)

    Declaration
    public bool WriteUIntNetworkByteOrder(uint value)
    Parameters
    Type Name Description
    UInt32 value
    Returns
    Type Description
    Boolean

    WriteULong(UInt64)

    Declaration
    public bool WriteULong(ulong value)
    Parameters
    Type Name Description
    UInt64 value
    Returns
    Type Description
    Boolean

    WriteUShort(UInt16)

    Declaration
    public bool WriteUShort(ushort value)
    Parameters
    Type Name Description
    UInt16 value
    Returns
    Type Description
    Boolean

    WriteUShortNetworkByteOrder(UInt16)

    Declaration
    public bool WriteUShortNetworkByteOrder(ushort value)
    Parameters
    Type Name Description
    UInt16 value
    Returns
    Type Description
    Boolean
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023