> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md).

# Class ksStreamBuffer

Namespace: [KS.Reactor](/reactor/api-reference/ks.reactor.md)\
Assembly: KSCommon.dll

Manages a buffer for reading and writing stream data to a byte array.

```csharp
public class ksStreamBuffer
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† [ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Constructors

### ksStreamBuffer() <a href="#ks_reactor_ksstreambuffer__ctor" id="ks_reactor_ksstreambuffer__ctor"></a>

Constructor

```csharp
public ksStreamBuffer()
```

### ksStreamBuffer(byte\[]) <a href="#ks_reactor_ksstreambuffer__ctor_system_byte" id="ks_reactor_ksstreambuffer__ctor_system_byte"></a>

Constructor

```csharp
public ksStreamBuffer(byte[] data)
```

#### Parameters

`data` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Buffer data

## Fields

### INT24\_MAX <a href="#ks_reactor_ksstreambuffer_int24_max" id="ks_reactor_ksstreambuffer_int24_max"></a>

Max value that can be written using [WriteInt24](#KS_Reactor_ksStreamBuffer_WriteInt24_System_Int32_).

```csharp
public static int INT24_MAX
```

#### Field Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### INT24\_MIN <a href="#ks_reactor_ksstreambuffer_int24_min" id="ks_reactor_ksstreambuffer_int24_min"></a>

Min value that can be written using [WriteInt24](#KS_Reactor_ksStreamBuffer_WriteInt24_System_Int32_).

```csharp
public static int INT24_MIN
```

#### Field Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### INT48\_MAX <a href="#ks_reactor_ksstreambuffer_int48_max" id="ks_reactor_ksstreambuffer_int48_max"></a>

Max value that can be written using [WriteInt48](#KS_Reactor_ksStreamBuffer_WriteInt48_System_Int64_).

```csharp
public static long INT48_MAX
```

#### Field Value

[long](https://learn.microsoft.com/dotnet/api/system.int64)

### INT48\_MIN <a href="#ks_reactor_ksstreambuffer_int48_min" id="ks_reactor_ksstreambuffer_int48_min"></a>

Min value that can be written using [WriteInt48](#KS_Reactor_ksStreamBuffer_WriteInt48_System_Int64_).

```csharp
public static long INT48_MIN
```

#### Field Value

[long](https://learn.microsoft.com/dotnet/api/system.int64)

### UINT24\_MAX <a href="#ks_reactor_ksstreambuffer_uint24_max" id="ks_reactor_ksstreambuffer_uint24_max"></a>

Max value that can be written using [WriteUInt24](#KS_Reactor_ksStreamBuffer_WriteUInt24_System_UInt32_).

```csharp
public static uint UINT24_MAX
```

#### Field Value

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)

### UINT48\_MAX <a href="#ks_reactor_ksstreambuffer_uint48_max" id="ks_reactor_ksstreambuffer_uint48_max"></a>

Max value that can be written using [WriteUInt48](#KS_Reactor_ksStreamBuffer_WriteUInt48_System_UInt64_).

```csharp
public static ulong UINT48_MAX
```

#### Field Value

[ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

## Properties

### Array <a href="#ks_reactor_ksstreambuffer_array" id="ks_reactor_ksstreambuffer_array"></a>

Byte array managed by the stream buffer. Note: active buffers may only be using up to Count bytes of this array.

```csharp
public byte[] Array { get; }
```

#### Property Value

[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

### Count <a href="#ks_reactor_ksstreambuffer_count" id="ks_reactor_ksstreambuffer_count"></a>

Amount of data in the managed array used by the buffer.

```csharp
public int Count { get; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### Offset <a href="#ks_reactor_ksstreambuffer_offset" id="ks_reactor_ksstreambuffer_offset"></a>

```csharp
[Obsolete("Use ReadOffset or WriteOffset")]
public int Offset { get; set; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### ReadOffset <a href="#ks_reactor_ksstreambuffer_readoffset" id="ks_reactor_ksstreambuffer_readoffset"></a>

Current position of the read cursor in the buffer. All read operations will access the managed array at this position.

```csharp
public int ReadOffset { get; set; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### WriteOffset <a href="#ks_reactor_ksstreambuffer_writeoffset" id="ks_reactor_ksstreambuffer_writeoffset"></a>

Current position of the write cursor in the buffer. All write operations will access the managed array at this position.

```csharp
public int WriteOffset { get; set; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

## Methods

### Clear(bool) <a href="#ks_reactor_ksstreambuffer_clear_system_boolean" id="ks_reactor_ksstreambuffer_clear_system_boolean"></a>

Clears all data from the buffer.

```csharp
public void Clear(bool zero = false)
```

#### Parameters

`zero` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If this is true, all bytes in the managed array will be set to 0.

### CopyAndRelease() <a href="#ks_reactor_ksstreambuffer_copyandrelease" id="ks_reactor_ksstreambuffer_copyandrelease"></a>

Copies and returns the contents of the buffer, and releases the buffer into the pool of available buffers.

```csharp
public byte[] CopyAndRelease()
```

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Buffer contents

### Create() <a href="#ks_reactor_ksstreambuffer_create" id="ks_reactor_ksstreambuffer_create"></a>

Fetches a ksStreamBuffer from a pool of available buffers or create a new ksStreamBuffer if the pool is empty.

```csharp
public static ksStreamBuffer Create()
```

#### Returns

[ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md)

### Flush() <a href="#ks_reactor_ksstreambuffer_flush" id="ks_reactor_ksstreambuffer_flush"></a>

Copies and returns the contents of the buffer, and clears the buffer.

```csharp
public byte[] Flush()
```

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Buffer contents

### GetSegment(int, int) <a href="#ks_reactor_ksstreambuffer_getsegment_system_int32_system_int32" id="ks_reactor_ksstreambuffer_getsegment_system_int32_system_int32"></a>

Gets a segment of the buffer. Throws a IndexOutOfRangeException if the requested start and end indexes go off the buffer.

```csharp
public ksStreamBuffer.Segment GetSegment(int offset = 0, int count = -1)
```

#### Parameters

`offset` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Segment start index.

`count` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Segment size (-1 up to the end of the buffer).

#### Returns

[ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md).[Segment](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer/ks.reactor.ksstreambuffer.segment.md)

Buffer segment

### Read() <a href="#ks_reactor_ksstreambuffer_read" id="ks_reactor_ksstreambuffer_read"></a>

```csharp
[Obsolete("Use ReadByte instead.")]
public byte Read()
```

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)

### Read\<T>() <a href="#ks_reactor_ksstreambuffer_read__1" id="ks_reactor_ksstreambuffer_read__1"></a>

Reads a struct from the buffer.

```csharp
public T Read<T>() where T : struct
```

#### Returns

T

Struct value

#### Type Parameters

`T`

Struct type

### ReadArray\<T>() <a href="#ks_reactor_ksstreambuffer_readarray__1" id="ks_reactor_ksstreambuffer_readarray__1"></a>

Reads a struct array from the buffer.

```csharp
public T[] ReadArray<T>() where T : struct
```

#### Returns

T\[]

Struct array

#### Type Parameters

`T`

Struct type

### ReadBool() <a href="#ks_reactor_ksstreambuffer_readbool" id="ks_reactor_ksstreambuffer_readbool"></a>

Reads a bool from the buffer.

```csharp
public bool ReadBool()
```

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Bool value

### ReadBoolArray() <a href="#ks_reactor_ksstreambuffer_readboolarray" id="ks_reactor_ksstreambuffer_readboolarray"></a>

Reads a bool array from the buffer.

```csharp
public bool[] ReadBoolArray()
```

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\[]

Bool array

### ReadByte() <a href="#ks_reactor_ksstreambuffer_readbyte" id="ks_reactor_ksstreambuffer_readbyte"></a>

Reads the byte at the current buffer read offset.

```csharp
public byte ReadByte()
```

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)

### ReadByteArray() <a href="#ks_reactor_ksstreambuffer_readbytearray" id="ks_reactor_ksstreambuffer_readbytearray"></a>

Reads a byte array from the buffer.

```csharp
public byte[] ReadByteArray()
```

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Byte array

### ReadBytes(int) <a href="#ks_reactor_ksstreambuffer_readbytes_system_int32" id="ks_reactor_ksstreambuffer_readbytes_system_int32"></a>

Reads multiple bytes at the current buffer read offset.

```csharp
public byte[] ReadBytes(int count = -1)
```

#### Parameters

`count` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of bytes to read (-1 = up to the end of the buffer).

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

### ReadChar() <a href="#ks_reactor_ksstreambuffer_readchar" id="ks_reactor_ksstreambuffer_readchar"></a>

Reads a char from the buffer.

```csharp
public char ReadChar()
```

#### Returns

[char](https://learn.microsoft.com/dotnet/api/system.char)

Char value

### ReadCharArray() <a href="#ks_reactor_ksstreambuffer_readchararray" id="ks_reactor_ksstreambuffer_readchararray"></a>

Reads a char array from the buffer.

```csharp
public char[] ReadCharArray()
```

#### Returns

[char](https://learn.microsoft.com/dotnet/api/system.char)\[]

Char array

### ReadDouble() <a href="#ks_reactor_ksstreambuffer_readdouble" id="ks_reactor_ksstreambuffer_readdouble"></a>

Reads a double from the buffer.

```csharp
public double ReadDouble()
```

#### Returns

[double](https://learn.microsoft.com/dotnet/api/system.double)

Double value

### ReadDoubleArray() <a href="#ks_reactor_ksstreambuffer_readdoublearray" id="ks_reactor_ksstreambuffer_readdoublearray"></a>

Reads a double array from the buffer.

```csharp
public double[] ReadDoubleArray()
```

#### Returns

[double](https://learn.microsoft.com/dotnet/api/system.double)\[]

Double array

### ReadEncodedInt() <a href="#ks_reactor_ksstreambuffer_readencodedint" id="ks_reactor_ksstreambuffer_readencodedint"></a>

Reads an int from the buffer using 7-bit encoding. 7 bits of the value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public int ReadEncodedInt()
```

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)

Int value

### ReadEncodedIntArray() <a href="#ks_reactor_ksstreambuffer_readencodedintarray" id="ks_reactor_ksstreambuffer_readencodedintarray"></a>

Reads an int array from the buffer using 7-bit encoding. 7 bits of each value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public int[] ReadEncodedIntArray()
```

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Int array

### ReadEncodedLong() <a href="#ks_reactor_ksstreambuffer_readencodedlong" id="ks_reactor_ksstreambuffer_readencodedlong"></a>

Reads a long from the buffer using 7-bit encoding. 7 bits of the value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public long ReadEncodedLong()
```

#### Returns

[long](https://learn.microsoft.com/dotnet/api/system.int64)

Long value

### ReadEncodedLongArray() <a href="#ks_reactor_ksstreambuffer_readencodedlongarray" id="ks_reactor_ksstreambuffer_readencodedlongarray"></a>

Reads a long array from the buffer using 7-bit encoding. 7 bits of each value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public long[] ReadEncodedLongArray()
```

#### Returns

[long](https://learn.microsoft.com/dotnet/api/system.int64)\[]

Long array

### ReadEncodedUInt() <a href="#ks_reactor_ksstreambuffer_readencodeduint" id="ks_reactor_ksstreambuffer_readencodeduint"></a>

Reads a uint from the buffer using 7-bit encoding. 7 bits of the value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public uint ReadEncodedUInt()
```

#### Returns

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)

UInt value

### ReadEncodedUIntArray() <a href="#ks_reactor_ksstreambuffer_readencodeduintarray" id="ks_reactor_ksstreambuffer_readencodeduintarray"></a>

Reads a uint array from the buffer using 7-bit encoding. 7 bits of each value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public uint[] ReadEncodedUIntArray()
```

#### Returns

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)\[]

UInt array

### ReadEncodedULong() <a href="#ks_reactor_ksstreambuffer_readencodedulong" id="ks_reactor_ksstreambuffer_readencodedulong"></a>

Reads a ulong from the buffer using 7-bit encoding. 7 bits of the value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public ulong ReadEncodedULong()
```

#### Returns

[ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

ULong value

### ReadEncodedULongArray() <a href="#ks_reactor_ksstreambuffer_readencodedulongarray" id="ks_reactor_ksstreambuffer_readencodedulongarray"></a>

Reads a ulong array from the buffer using 7-bit encoding. 7 bits of each value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public ulong[] ReadEncodedULongArray()
```

#### Returns

[ulong](https://learn.microsoft.com/dotnet/api/system.uint64)\[]

ULong array

### ReadEncodedVector2Int() <a href="#ks_reactor_ksstreambuffer_readencodedvector2int" id="ks_reactor_ksstreambuffer_readencodedvector2int"></a>

Reads a [ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md) from the buffer using 7-bit encoding.

```csharp
public ksVector2Int ReadEncodedVector2Int()
```

#### Returns

[ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md)

Int vector2 value

### ReadEncodedVector2IntArray() <a href="#ks_reactor_ksstreambuffer_readencodedvector2intarray" id="ks_reactor_ksstreambuffer_readencodedvector2intarray"></a>

Reads a [ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md) array from the buffer using 7-bit encoding. 7 bits of each value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public ksVector2Int[] ReadEncodedVector2IntArray()
```

#### Returns

[ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md)\[]

Int vector2 array

### ReadEncodedVector3Int() <a href="#ks_reactor_ksstreambuffer_readencodedvector3int" id="ks_reactor_ksstreambuffer_readencodedvector3int"></a>

Reads a [ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md) from the buffer using 7-bit encoding.

```csharp
public ksVector3Int ReadEncodedVector3Int()
```

#### Returns

[ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md)

Int vector3 value

### ReadEncodedVector3IntArray() <a href="#ks_reactor_ksstreambuffer_readencodedvector3intarray" id="ks_reactor_ksstreambuffer_readencodedvector3intarray"></a>

Reads a [ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md) array from the buffer using 7-bit encoding. 7 bits of each value are read at a time, and the 8th bit indicates if there is more data to read.

```csharp
public ksVector3Int[] ReadEncodedVector3IntArray()
```

#### Returns

[ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md)\[]

Int vector3 array

### ReadFloat() <a href="#ks_reactor_ksstreambuffer_readfloat" id="ks_reactor_ksstreambuffer_readfloat"></a>

Reads a float from the buffer.

```csharp
public float ReadFloat()
```

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Float value

### ReadFloatArray() <a href="#ks_reactor_ksstreambuffer_readfloatarray" id="ks_reactor_ksstreambuffer_readfloatarray"></a>

Reads a float array from the buffer.

```csharp
public float[] ReadFloatArray()
```

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)\[]

Float array

### ReadInt() <a href="#ks_reactor_ksstreambuffer_readint" id="ks_reactor_ksstreambuffer_readint"></a>

Reads an int from the buffer.

```csharp
public int ReadInt()
```

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)

Int value

### ReadInt24() <a href="#ks_reactor_ksstreambuffer_readint24" id="ks_reactor_ksstreambuffer_readint24"></a>

Reads an int using 3 bytes.

```csharp
public int ReadInt24()
```

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)

Int value

### ReadInt48() <a href="#ks_reactor_ksstreambuffer_readint48" id="ks_reactor_ksstreambuffer_readint48"></a>

Reads a long using 6 bytes.

```csharp
public long ReadInt48()
```

#### Returns

[long](https://learn.microsoft.com/dotnet/api/system.int64)

Long value

### ReadIntArray() <a href="#ks_reactor_ksstreambuffer_readintarray" id="ks_reactor_ksstreambuffer_readintarray"></a>

Reads an int array from the buffer.

```csharp
public int[] ReadIntArray()
```

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Int array

### ReadLong() <a href="#ks_reactor_ksstreambuffer_readlong" id="ks_reactor_ksstreambuffer_readlong"></a>

Reads a long from the buffer.

```csharp
public long ReadLong()
```

#### Returns

[long](https://learn.microsoft.com/dotnet/api/system.int64)

Long value

### ReadLongArray() <a href="#ks_reactor_ksstreambuffer_readlongarray" id="ks_reactor_ksstreambuffer_readlongarray"></a>

Reads a long array from the buffer.

```csharp
public long[] ReadLongArray()
```

#### Returns

[long](https://learn.microsoft.com/dotnet/api/system.int64)\[]

Long array

### ReadMultiType() <a href="#ks_reactor_ksstreambuffer_readmultitype" id="ks_reactor_ksstreambuffer_readmultitype"></a>

Reads a [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md) from the buffer.

```csharp
public ksMultiType ReadMultiType()
```

#### Returns

[ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)

MultiType value

### ReadMultiTypeArray() <a href="#ks_reactor_ksstreambuffer_readmultitypearray" id="ks_reactor_ksstreambuffer_readmultitypearray"></a>

Reads a [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md) array from the buffer.

```csharp
public ksMultiType[] ReadMultiTypeArray()
```

#### Returns

[ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)\[]

MultiType array

### ReadSByte() <a href="#ks_reactor_ksstreambuffer_readsbyte" id="ks_reactor_ksstreambuffer_readsbyte"></a>

Reads an sbyte from the buffer.

```csharp
public sbyte ReadSByte()
```

#### Returns

[sbyte](https://learn.microsoft.com/dotnet/api/system.sbyte)

### ReadSByteArray() <a href="#ks_reactor_ksstreambuffer_readsbytearray" id="ks_reactor_ksstreambuffer_readsbytearray"></a>

Reads an sbyte array from the buffer.

```csharp
public sbyte[] ReadSByteArray()
```

#### Returns

[sbyte](https://learn.microsoft.com/dotnet/api/system.sbyte)\[]

SByte array

### ReadSerializable\<T>() <a href="#ks_reactor_ksstreambuffer_readserializable__1" id="ks_reactor_ksstreambuffer_readserializable__1"></a>

Reads a `T` that implements [ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md) from the buffer.

```csharp
public T ReadSerializable<T>() where T : ksISerializable, new()
```

#### Returns

T

Object value

#### Type Parameters

`T`

Type to read.

### ReadSerializableArray\<T>() <a href="#ks_reactor_ksstreambuffer_readserializablearray__1" id="ks_reactor_ksstreambuffer_readserializablearray__1"></a>

Reads an array of `T` that implement [ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md) from the buffer.

```csharp
public T[] ReadSerializableArray<T>() where T : ksISerializable, new()
```

#### Returns

T\[]

Object array

#### Type Parameters

`T`

Type that implements [ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md)

### ReadShort() <a href="#ks_reactor_ksstreambuffer_readshort" id="ks_reactor_ksstreambuffer_readshort"></a>

Reads a short from the buffer.

```csharp
public short ReadShort()
```

#### Returns

[short](https://learn.microsoft.com/dotnet/api/system.int16)

Short value

### ReadShortArray() <a href="#ks_reactor_ksstreambuffer_readshortarray" id="ks_reactor_ksstreambuffer_readshortarray"></a>

Reads a short array from the buffer.

```csharp
public short[] ReadShortArray()
```

#### Returns

[short](https://learn.microsoft.com/dotnet/api/system.int16)\[]

Short array

### ReadString() <a href="#ks_reactor_ksstreambuffer_readstring" id="ks_reactor_ksstreambuffer_readstring"></a>

Reads a string from the buffer.

```csharp
public string ReadString()
```

#### Returns

[string](https://learn.microsoft.com/dotnet/api/system.string)

String value

### ReadStringArray() <a href="#ks_reactor_ksstreambuffer_readstringarray" id="ks_reactor_ksstreambuffer_readstringarray"></a>

Reads a string array from the buffer.

```csharp
public string[] ReadStringArray()
```

#### Returns

[string](https://learn.microsoft.com/dotnet/api/system.string)\[]

String array

### ReadUInt() <a href="#ks_reactor_ksstreambuffer_readuint" id="ks_reactor_ksstreambuffer_readuint"></a>

Reads a uint from the buffer.

```csharp
public uint ReadUInt()
```

#### Returns

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)

UInt value

### ReadUInt24() <a href="#ks_reactor_ksstreambuffer_readuint24" id="ks_reactor_ksstreambuffer_readuint24"></a>

Reads a uint using 3 bytes.

```csharp
public uint ReadUInt24()
```

#### Returns

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)

UInt value

### ReadUInt48() <a href="#ks_reactor_ksstreambuffer_readuint48" id="ks_reactor_ksstreambuffer_readuint48"></a>

Reads a ulong using 6 bytes.

```csharp
public ulong ReadUInt48()
```

#### Returns

[ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

ULong value

### ReadUIntArray() <a href="#ks_reactor_ksstreambuffer_readuintarray" id="ks_reactor_ksstreambuffer_readuintarray"></a>

Reads a uint array from the buffer.

```csharp
public uint[] ReadUIntArray()
```

#### Returns

[uint](https://learn.microsoft.com/dotnet/api/system.uint32)\[]

UInt array

### ReadULong() <a href="#ks_reactor_ksstreambuffer_readulong" id="ks_reactor_ksstreambuffer_readulong"></a>

Reads a ulong from the buffer.

```csharp
public ulong ReadULong()
```

#### Returns

[ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

ULong value

### ReadULongArray() <a href="#ks_reactor_ksstreambuffer_readulongarray" id="ks_reactor_ksstreambuffer_readulongarray"></a>

Reads a ulong array from the buffer.

```csharp
public ulong[] ReadULongArray()
```

#### Returns

[ulong](https://learn.microsoft.com/dotnet/api/system.uint64)\[]

ULong array

### ReadUShort() <a href="#ks_reactor_ksstreambuffer_readushort" id="ks_reactor_ksstreambuffer_readushort"></a>

Reads a ushort from the buffer.

```csharp
public ushort ReadUShort()
```

#### Returns

[ushort](https://learn.microsoft.com/dotnet/api/system.uint16)

UShort value

### ReadUShortArray() <a href="#ks_reactor_ksstreambuffer_readushortarray" id="ks_reactor_ksstreambuffer_readushortarray"></a>

Reads a ushort array from the buffer.

```csharp
public ushort[] ReadUShortArray()
```

#### Returns

[ushort](https://learn.microsoft.com/dotnet/api/system.uint16)\[]

UShort array

### Release() <a href="#ks_reactor_ksstreambuffer_release" id="ks_reactor_ksstreambuffer_release"></a>

Releases the buffer and put it pool of available buffers. Throws an exception if the buffer has unreleased segments.

```csharp
public void Release()
```

### Reserve(int, bool) <a href="#ks_reactor_ksstreambuffer_reserve_system_int32_system_boolean" id="ks_reactor_ksstreambuffer_reserve_system_int32_system_boolean"></a>

Reserves space to write to by `size` bytes, growing the buffer if necessary.

```csharp
public int Reserve(int size, bool advance = true)
```

#### Parameters

`size` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Size to reserve for writing later.

`advance` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If true, will advance the write offset to the end of the reserved space.

#### Returns

[int](https://learn.microsoft.com/dotnet/api/system.int32)

The offset to the start of the reserved space.

### ResizeBuffer(int) <a href="#ks_reactor_ksstreambuffer_resizebuffer_system_int32" id="ks_reactor_ksstreambuffer_resizebuffer_system_int32"></a>

Resizes and zeros the used portion of the manage array.

```csharp
public void ResizeBuffer(int size)
```

#### Parameters

`size` [int](https://learn.microsoft.com/dotnet/api/system.int32)

New size.

### ToArray() <a href="#ks_reactor_ksstreambuffer_toarray" id="ks_reactor_ksstreambuffer_toarray"></a>

Copies and returns the contents of the buffer.

```csharp
public byte[] ToArray()
```

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Buffer contents

### TryGetSegment(out Segment, int, int) <a href="#ks_reactor_ksstreambuffer_trygetsegment_ks_reactor_ksstreambuffer_segment__system_int32_system_int32" id="ks_reactor_ksstreambuffer_trygetsegment_ks_reactor_ksstreambuffer_segment__system_int32_system_int32"></a>

Attempts to get a segment of the buffer.

```csharp
public bool TryGetSegment(out ksStreamBuffer.Segment segment, int offset = 0, int count = -1)
```

#### Parameters

`segment` [ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md).[Segment](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer/ks.reactor.ksstreambuffer.segment.md)

Segement of buffer.

`offset` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Segment start index.

`count` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Segment size (-1 up to the end of the buffer).

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if a segment could be retrieved.

### TryRelease() <a href="#ks_reactor_ksstreambuffer_tryrelease" id="ks_reactor_ksstreambuffer_tryrelease"></a>

Tries to release the buffer into the pool of available buffers. The buffer cannot be released if it has any unreleased segments or if it's size is too large or the pool is full.

```csharp
public bool TryRelease()
```

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the buffer was released.

### Write(byte) <a href="#ks_reactor_ksstreambuffer_write_system_byte" id="ks_reactor_ksstreambuffer_write_system_byte"></a>

Writes a byte value at the current buffer write offset.

```csharp
public void Write(byte value)
```

#### Parameters

`value` [byte](https://learn.microsoft.com/dotnet/api/system.byte)

### Write(ArraySegment\<byte>) <a href="#ks_reactor_ksstreambuffer_write_system_arraysegment_system_byte" id="ks_reactor_ksstreambuffer_write_system_arraysegment_system_byte"></a>

Writes a segment of a byte array to the buffer.

```csharp
public void Write(ArraySegment<byte> segment)
```

#### Parameters

`segment` [ArraySegment](https://learn.microsoft.com/dotnet/api/system.arraysegment-1)<[byte](https://learn.microsoft.com/dotnet/api/system.byte)>

Segment to write.

### Write(Segment) <a href="#ks_reactor_ksstreambuffer_write_ks_reactor_ksstreambuffer_segment" id="ks_reactor_ksstreambuffer_write_ks_reactor_ksstreambuffer_segment"></a>

Writes a [Segment](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer/ks.reactor.ksstreambuffer.segment.md) into the buffer.

```csharp
public void Write(ksStreamBuffer.Segment segment)
```

#### Parameters

`segment` [ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md).[Segment](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer/ks.reactor.ksstreambuffer.segment.md)

[Segment](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer/ks.reactor.ksstreambuffer.segment.md) from a different [ksStreamBuffer](/reactor/api-reference/ks.reactor/ks.reactor.ksstreambuffer.md)

### Write(sbyte) <a href="#ks_reactor_ksstreambuffer_write_system_sbyte" id="ks_reactor_ksstreambuffer_write_system_sbyte"></a>

Writes an sbyte value at the current buffer write offset.

```csharp
public void Write(sbyte value)
```

#### Parameters

`value` [sbyte](https://learn.microsoft.com/dotnet/api/system.sbyte)

### Write(short) <a href="#ks_reactor_ksstreambuffer_write_system_int16" id="ks_reactor_ksstreambuffer_write_system_int16"></a>

Writes a short to the buffer.

```csharp
public void Write(short value)
```

#### Parameters

`value` [short](https://learn.microsoft.com/dotnet/api/system.int16)

Value to write.

### Write(ushort) <a href="#ks_reactor_ksstreambuffer_write_system_uint16" id="ks_reactor_ksstreambuffer_write_system_uint16"></a>

Writes a ushort to the buffer.

```csharp
public void Write(ushort value)
```

#### Parameters

`value` [ushort](https://learn.microsoft.com/dotnet/api/system.uint16)

Value to write.

### Write(int) <a href="#ks_reactor_ksstreambuffer_write_system_int32" id="ks_reactor_ksstreambuffer_write_system_int32"></a>

Writes an int to the buffer.

```csharp
public void Write(int value)
```

#### Parameters

`value` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Value to write.

### Write(uint) <a href="#ks_reactor_ksstreambuffer_write_system_uint32" id="ks_reactor_ksstreambuffer_write_system_uint32"></a>

Writes a uint to the buffer.

```csharp
public void Write(uint value)
```

#### Parameters

`value` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)

Value to write.

### Write(long) <a href="#ks_reactor_ksstreambuffer_write_system_int64" id="ks_reactor_ksstreambuffer_write_system_int64"></a>

Writes a long to the buffer.

```csharp
public void Write(long value)
```

#### Parameters

`value` [long](https://learn.microsoft.com/dotnet/api/system.int64)

Value to write.

### Write(ulong) <a href="#ks_reactor_ksstreambuffer_write_system_uint64" id="ks_reactor_ksstreambuffer_write_system_uint64"></a>

Writes a ulong to the buffer.

```csharp
public void Write(ulong value)
```

#### Parameters

`value` [ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

Value to write.

### Write(float) <a href="#ks_reactor_ksstreambuffer_write_system_single" id="ks_reactor_ksstreambuffer_write_system_single"></a>

Writes a float to the buffer.

```csharp
public void Write(float value)
```

#### Parameters

`value` [float](https://learn.microsoft.com/dotnet/api/system.single)

Value to write.

### Write(double) <a href="#ks_reactor_ksstreambuffer_write_system_double" id="ks_reactor_ksstreambuffer_write_system_double"></a>

Writes a double to the buffer.

```csharp
public void Write(double value)
```

#### Parameters

`value` [double](https://learn.microsoft.com/dotnet/api/system.double)

Value to write.

### Write(char) <a href="#ks_reactor_ksstreambuffer_write_system_char" id="ks_reactor_ksstreambuffer_write_system_char"></a>

Writes a char to the buffer.

```csharp
public void Write(char value)
```

#### Parameters

`value` [char](https://learn.microsoft.com/dotnet/api/system.char)

Value to write.

### Write(bool) <a href="#ks_reactor_ksstreambuffer_write_system_boolean" id="ks_reactor_ksstreambuffer_write_system_boolean"></a>

Writes a bool to the buffer.

```csharp
public void Write(bool value)
```

#### Parameters

`value` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Value to write.

### Write(string) <a href="#ks_reactor_ksstreambuffer_write_system_string" id="ks_reactor_ksstreambuffer_write_system_string"></a>

Writes a string to the buffer.

```csharp
public void Write(string value)
```

#### Parameters

`value` [string](https://learn.microsoft.com/dotnet/api/system.string)

Value to write. May be null.

### Write\<T>(T) <a href="#ks_reactor_ksstreambuffer_write__1___0" id="ks_reactor_ksstreambuffer_write__1___0"></a>

Writes a struct to the buffer.

```csharp
public void Write<T>(T value) where T : struct
```

#### Parameters

`value` T

Value to write.

#### Type Parameters

`T`

Struct type

### Write(ksISerializable) <a href="#ks_reactor_ksstreambuffer_write_ks_reactor_ksiserializable" id="ks_reactor_ksstreambuffer_write_ks_reactor_ksiserializable"></a>

Writes a [ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md) to the buffer.

```csharp
public void Write(ksISerializable serializable)
```

#### Parameters

`serializable` [ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md)

Value to write. May be null.

### Write(ksMultiType) <a href="#ks_reactor_ksstreambuffer_write_ks_reactor_ksmultitype" id="ks_reactor_ksstreambuffer_write_ks_reactor_ksmultitype"></a>

Writes a [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md) to the buffer.

```csharp
public void Write(ksMultiType value)
```

#### Parameters

`value` [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)

Value to write.

### Write(byte\[]) <a href="#ks_reactor_ksstreambuffer_write_system_byte" id="ks_reactor_ksstreambuffer_write_system_byte"></a>

Writes a byte array to the buffer along with its size.

```csharp
public void Write(byte[] array)
```

#### Parameters

`array` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Array to write. May be null.

### Write(sbyte\[]) <a href="#ks_reactor_ksstreambuffer_write_system_sbyte" id="ks_reactor_ksstreambuffer_write_system_sbyte"></a>

Writes an sbyte array to the buffer along with its size.

```csharp
public void Write(sbyte[] array)
```

#### Parameters

`array` [sbyte](https://learn.microsoft.com/dotnet/api/system.sbyte)\[]

Array to write. May be null.

### Write(short\[]) <a href="#ks_reactor_ksstreambuffer_write_system_int16" id="ks_reactor_ksstreambuffer_write_system_int16"></a>

Writes a short array to the buffer along with its size.

```csharp
public void Write(short[] array)
```

#### Parameters

`array` [short](https://learn.microsoft.com/dotnet/api/system.int16)\[]

Array to write. May be null.

### Write(ushort\[]) <a href="#ks_reactor_ksstreambuffer_write_system_uint16" id="ks_reactor_ksstreambuffer_write_system_uint16"></a>

Writes a ushort array to the buffer along with its size.

```csharp
public void Write(ushort[] array)
```

#### Parameters

`array` [ushort](https://learn.microsoft.com/dotnet/api/system.uint16)\[]

Array to write. May be null.

### Write(int\[]) <a href="#ks_reactor_ksstreambuffer_write_system_int32" id="ks_reactor_ksstreambuffer_write_system_int32"></a>

Writes an int array to the buffer along with its size.

```csharp
public void Write(int[] array)
```

#### Parameters

`array` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Array to write. May be null.

### Write(uint\[]) <a href="#ks_reactor_ksstreambuffer_write_system_uint32" id="ks_reactor_ksstreambuffer_write_system_uint32"></a>

Writes a uint array to the buffer along with its size.

```csharp
public void Write(uint[] array)
```

#### Parameters

`array` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)\[]

Array to write. May be null.

### Write(long\[]) <a href="#ks_reactor_ksstreambuffer_write_system_int64" id="ks_reactor_ksstreambuffer_write_system_int64"></a>

Writes a long array to the buffer along with its size.

```csharp
public void Write(long[] array)
```

#### Parameters

`array` [long](https://learn.microsoft.com/dotnet/api/system.int64)\[]

Array to write. May be null.

### Write(ulong\[]) <a href="#ks_reactor_ksstreambuffer_write_system_uint64" id="ks_reactor_ksstreambuffer_write_system_uint64"></a>

Writes a ulong array to the buffer along with its size.

```csharp
public void Write(ulong[] array)
```

#### Parameters

`array` [ulong](https://learn.microsoft.com/dotnet/api/system.uint64)\[]

Array to write. May be null.

### Write(float\[]) <a href="#ks_reactor_ksstreambuffer_write_system_single" id="ks_reactor_ksstreambuffer_write_system_single"></a>

Writes a float array to the buffer along with its size.

```csharp
public void Write(float[] array)
```

#### Parameters

`array` [float](https://learn.microsoft.com/dotnet/api/system.single)\[]

Array to write. May be null.

### Write(double\[]) <a href="#ks_reactor_ksstreambuffer_write_system_double" id="ks_reactor_ksstreambuffer_write_system_double"></a>

Writes a double array to the buffer along with its size.

```csharp
public void Write(double[] array)
```

#### Parameters

`array` [double](https://learn.microsoft.com/dotnet/api/system.double)\[]

Array to write. May be null.

### Write(char\[]) <a href="#ks_reactor_ksstreambuffer_write_system_char" id="ks_reactor_ksstreambuffer_write_system_char"></a>

Writes a char array to the buffer along with its size.

```csharp
public void Write(char[] array)
```

#### Parameters

`array` [char](https://learn.microsoft.com/dotnet/api/system.char)\[]

Array to write. May be null.

### Write(bool\[]) <a href="#ks_reactor_ksstreambuffer_write_system_boolean" id="ks_reactor_ksstreambuffer_write_system_boolean"></a>

Writes a bool array to the buffer along with its size.

```csharp
public void Write(bool[] array)
```

#### Parameters

`array` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)\[]

Array to write. May be null.

### Write(string\[]) <a href="#ks_reactor_ksstreambuffer_write_system_string" id="ks_reactor_ksstreambuffer_write_system_string"></a>

Writes a string array to the buffer along with its size.

```csharp
public void Write(string[] array)
```

#### Parameters

`array` [string](https://learn.microsoft.com/dotnet/api/system.string)\[]

Array to write. May be null.

### Write\<T>(T\[]) <a href="#ks_reactor_ksstreambuffer_write__1___0" id="ks_reactor_ksstreambuffer_write__1___0"></a>

Writes a struct `T` array to the buffer along with its size.

```csharp
public void Write<T>(T[] array) where T : struct
```

#### Parameters

`array` T\[]

Array to write. May be null.

#### Type Parameters

`T`

Struct type

### Write(ksMultiType\[]) <a href="#ks_reactor_ksstreambuffer_write_ks_reactor_ksmultitype" id="ks_reactor_ksstreambuffer_write_ks_reactor_ksmultitype"></a>

Writes an array of multitypes to the buffer.

```csharp
public void Write(ksMultiType[] array)
```

#### Parameters

`array` [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)\[]

Array to write. May be null.

### WriteBytes(byte\[]) <a href="#ks_reactor_ksstreambuffer_writebytes_system_byte" id="ks_reactor_ksstreambuffer_writebytes_system_byte"></a>

Writes a byte array at the current buffer write offset.

```csharp
public void WriteBytes(byte[] value)
```

#### Parameters

`value` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

### WriteEncodedArray(int\[]) <a href="#ks_reactor_ksstreambuffer_writeencodedarray_system_int32" id="ks_reactor_ksstreambuffer_writeencodedarray_system_int32"></a>

Writes an int array to the buffer using 7-bit encoding. 7 bits of each value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedArray(int[] array)
```

#### Parameters

`array` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Array to encode. May be null.

### WriteEncodedArray(uint\[]) <a href="#ks_reactor_ksstreambuffer_writeencodedarray_system_uint32" id="ks_reactor_ksstreambuffer_writeencodedarray_system_uint32"></a>

Writes a uint array to the buffer using 7-bit encoding. 7 bits of each value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedArray(uint[] array)
```

#### Parameters

`array` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)\[]

Array to encode. May be null.

### WriteEncodedArray(long\[]) <a href="#ks_reactor_ksstreambuffer_writeencodedarray_system_int64" id="ks_reactor_ksstreambuffer_writeencodedarray_system_int64"></a>

Writes a long array to the buffer using 7-bit encoding. 7 bits of each value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedArray(long[] array)
```

#### Parameters

`array` [long](https://learn.microsoft.com/dotnet/api/system.int64)\[]

Array to encode. May be null.

### WriteEncodedArray(ulong\[]) <a href="#ks_reactor_ksstreambuffer_writeencodedarray_system_uint64" id="ks_reactor_ksstreambuffer_writeencodedarray_system_uint64"></a>

Writes a ulong array to the buffer using 7-bit encoding. 7 bits of each value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedArray(ulong[] array)
```

#### Parameters

`array` [ulong](https://learn.microsoft.com/dotnet/api/system.uint64)\[]

Array to encode. May be null.

### WriteEncodedArray(ksVector2Int\[]) <a href="#ks_reactor_ksstreambuffer_writeencodedarray_ks_reactor_ksvector2int" id="ks_reactor_ksstreambuffer_writeencodedarray_ks_reactor_ksvector2int"></a>

Writes a [ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md) array to the buffer using 7-bit encoding. 7 bits of each value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedArray(ksVector2Int[] array)
```

#### Parameters

`array` [ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md)\[]

Array to encode. May be null.

### WriteEncodedArray(ksVector3Int\[]) <a href="#ks_reactor_ksstreambuffer_writeencodedarray_ks_reactor_ksvector3int" id="ks_reactor_ksstreambuffer_writeencodedarray_ks_reactor_ksvector3int"></a>

Writes a [ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md) array to the buffer using 7-bit encoding. 7 bits of each value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedArray(ksVector3Int[] array)
```

#### Parameters

`array` [ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md)\[]

Array to encode. May be null.

### WriteEncodedValue(int) <a href="#ks_reactor_ksstreambuffer_writeencodedvalue_system_int32" id="ks_reactor_ksstreambuffer_writeencodedvalue_system_int32"></a>

Writes an int to the buffer using 7-bit encoding. 7 bits of the value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedValue(int value)
```

#### Parameters

`value` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Value to encode.

### WriteEncodedValue(uint) <a href="#ks_reactor_ksstreambuffer_writeencodedvalue_system_uint32" id="ks_reactor_ksstreambuffer_writeencodedvalue_system_uint32"></a>

Writes a uint to the buffer using 7-bit encoding. 7 bits of the value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedValue(uint value)
```

#### Parameters

`value` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)

Value to encode.

### WriteEncodedValue(long) <a href="#ks_reactor_ksstreambuffer_writeencodedvalue_system_int64" id="ks_reactor_ksstreambuffer_writeencodedvalue_system_int64"></a>

Writes a long to the buffer using 7-bit encoding. 7 bits of the value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedValue(long value)
```

#### Parameters

`value` [long](https://learn.microsoft.com/dotnet/api/system.int64)

Value to encode.

### WriteEncodedValue(ulong) <a href="#ks_reactor_ksstreambuffer_writeencodedvalue_system_uint64" id="ks_reactor_ksstreambuffer_writeencodedvalue_system_uint64"></a>

Writes a ulong to the buffer using 7-bit encoding. 7 bits of the value are written at a time, and the 8th bit indicates if there is more data to read.

```csharp
public void WriteEncodedValue(ulong value)
```

#### Parameters

`value` [ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

Value to encode.

### WriteEncodedVector(ksVector2Int) <a href="#ks_reactor_ksstreambuffer_writeencodedvector_ks_reactor_ksvector2int" id="ks_reactor_ksstreambuffer_writeencodedvector_ks_reactor_ksvector2int"></a>

Writes the values of a [ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md) to the buffer using 7-bit encoding.

```csharp
public void WriteEncodedVector(ksVector2Int vector)
```

#### Parameters

`vector` [ksVector2Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector2int.md)

### WriteEncodedVector(ksVector3Int) <a href="#ks_reactor_ksstreambuffer_writeencodedvector_ks_reactor_ksvector3int" id="ks_reactor_ksstreambuffer_writeencodedvector_ks_reactor_ksvector3int"></a>

Writes the values of a [ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md) to the buffer using 7-bit encoding.

```csharp
public void WriteEncodedVector(ksVector3Int vector)
```

#### Parameters

`vector` [ksVector3Int](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3int.md)

### WriteInt24(int) <a href="#ks_reactor_ksstreambuffer_writeint24_system_int32" id="ks_reactor_ksstreambuffer_writeint24_system_int32"></a>

Writes an int using 3 bytes. [INT24\_MIN](#KS_Reactor_ksStreamBuffer_INT24_MIN) is the min value that can be written and [INT24\_MAX](#KS_Reactor_ksStreamBuffer_INT24_MAX) is the max.

```csharp
public void WriteInt24(int value)
```

#### Parameters

`value` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Value to write.

### WriteInt48(long) <a href="#ks_reactor_ksstreambuffer_writeint48_system_int64" id="ks_reactor_ksstreambuffer_writeint48_system_int64"></a>

Writes a long using 6 bytes. [INT48\_MIN](#KS_Reactor_ksStreamBuffer_INT48_MIN) is the min value that can be written and [INT48\_MAX](#KS_Reactor_ksStreamBuffer_INT48_MAX) is the max.

```csharp
public void WriteInt48(long value)
```

#### Parameters

`value` [long](https://learn.microsoft.com/dotnet/api/system.int64)

Value to write.

### WriteSerializableArray\<T>(T\[]) <a href="#ks_reactor_ksstreambuffer_writeserializablearray__1___0" id="ks_reactor_ksstreambuffer_writeserializablearray__1___0"></a>

Writes an array of `T` that implement [ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md) to the buffer along with its size.

```csharp
public void WriteSerializableArray<T>(T[] array) where T : ksISerializable
```

#### Parameters

`array` T\[]

Array to write. May be null.

#### Type Parameters

`T`

Type that implements [ksISerializable](/reactor/api-reference/ks.reactor/ks.reactor.ksiserializable.md)

### WriteUInt24(uint) <a href="#ks_reactor_ksstreambuffer_writeuint24_system_uint32" id="ks_reactor_ksstreambuffer_writeuint24_system_uint32"></a>

Writes a uint using 3 bytes. [UINT24\_MAX](#KS_Reactor_ksStreamBuffer_UINT24_MAX) is the max value that can be written.

```csharp
public void WriteUInt24(uint value)
```

#### Parameters

`value` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)

Value to write.

### WriteUInt48(ulong) <a href="#ks_reactor_ksstreambuffer_writeuint48_system_uint64" id="ks_reactor_ksstreambuffer_writeuint48_system_uint64"></a>

Writes a ulong using 6 bytes. [UINT48\_MAX](#KS_Reactor_ksStreamBuffer_UINT48_MAX) is the max value that can be written.

```csharp
public void WriteUInt48(ulong value)
```

#### Parameters

`value` [ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

Value to write.
