Table of Contents

Class StreamPeerBuffer

Namespace
Godot
Assembly
GodotSharp.dll

A data buffer stream peer that uses a byte array as the stream. This object can be used to handle binary data from network sessions. To handle binary data stored in files, FileAccess can be used directly.

A StreamPeerBuffer object keeps an internal cursor which is the offset in bytes to the start of the buffer. Get and put operations are performed at the cursor position and will move the cursor accordingly.

public class StreamPeerBuffer : StreamPeer, IDisposable
Inheritance
StreamPeerBuffer
Implements
Inherited Members

Constructors

StreamPeerBuffer()

public StreamPeerBuffer()

Properties

DataArray

The underlying data buffer. Setting this value resets the cursor.

public byte[] DataArray { get; set; }

Property Value

byte[]

Methods

Clear()

Clears the DataArray and resets the cursor.

public void Clear()

Duplicate()

Returns a new StreamPeerBuffer with the same DataArray content.

public StreamPeerBuffer Duplicate()

Returns

StreamPeerBuffer

GetPosition()

Returns the current cursor position.

public int GetPosition()

Returns

int

GetSize()

Returns the size of DataArray.

public int GetSize()

Returns

int

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

Resize(int)

Resizes the DataArray. This doesn't update the cursor.

public void Resize(int size)

Parameters

size int

Seek(int)

Moves the cursor to the specified position. position must be a valid index of DataArray.

public void Seek(int position)

Parameters

position int