Skip to content

Mirror::NetworkWriter

Binary stream Writer. Supports simple types, buffers, arrays, structs, and nested types More...

Inherited by PooledNetworkWriter

Public Functions

Name
void Reset()
Reset both the position and length of the stream
void SetLength(int newLength)
Sets length, moves position if it is greater than new length
byte [] ToArray()
ArraySegment< byte > ToArraySegment()
void WriteByte(byte value)
void WriteBytes(byte [] buffer, int offset, int count)
void WriteUInt32(uint value)
void WriteInt32(int value)
void WriteUInt64(ulong value)
void WriteInt64(long value)
void Write< T >(T value)
Writes any type that mirror supports

Public Properties

Name
int Position

Public Attributes

Name
const int MaxStringLength
int Length

Detailed Description

class Mirror::NetworkWriter;

Binary stream Writer. Supports simple types, buffers, arrays, structs, and nested types

Use [NetworkWriter.GetWriter] to reduce memory allocation

Public Functions Documentation

function Reset

inline void Reset()

Reset both the position and length of the stream

Leaves the capacity the same so that we can reuse this writer without extra allocations

function SetLength

inline void SetLength(
    int newLength
)

Sets length, moves position if it is greater than new length

Parameters:

  • newLength

Zeros out any extra length created by setlength

function ToArray

inline byte [] ToArray()

function ToArraySegment

inline ArraySegment< byte > ToArraySegment()

function WriteByte

inline void WriteByte(
    byte value
)

function WriteBytes

inline void WriteBytes(
    byte [] buffer,
    int offset,
    int count
)

function WriteUInt32

inline void WriteUInt32(
    uint value
)

function WriteInt32

void WriteInt32(
    int value
)

function WriteUInt64

inline void WriteUInt64(
    ulong value
)

function WriteInt64

void WriteInt64(
    long value
)

function Write< T >

inline void Write< T >(
    T value
)

Writes any type that mirror supports

Parameters:

  • value

Template Parameters:

  • T

Public Property Documentation

property Position

int Position;

Public Attributes Documentation

variable MaxStringLength

const int MaxStringLength = 1024 * 32;

variable Length

int Length => length;

Updated on 25 January 2021 at 09:57:17 UTC