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
GetPosition()
Returns the current cursor position.
public int GetPosition()
Returns
GetSize()
Returns the size of DataArray.
public int GetSize()
Returns
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
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