Class StreamPeerBuffer
A stream peer used to handle binary data streams.
- Inheritance
-
StreamPeerBuffer
Remarks
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.
Properties
data_array
The underlying data buffer. Setting this value resets the cursor.
var data_array : PackedByteArray = PackedByteArray()
Property Value
Remarks
- void set_data_array(PackedByteArray value)
- PackedByteArray get_data_array
Methods
clear
Clears the data_array and resets the cursor.
void clear
duplicate
Qualifiers: const
Returns a new StreamPeerBuffer with the same data_array content.
StreamPeerBuffer duplicate
get_position
Qualifiers: const
Returns the current cursor position.
int get_position
get_size
Qualifiers: const
Returns the size of data_array.
int get_size
resize(int)
Resizes the data_array. This doesn't update the cursor.
void resize(int size)
Parameters
size
int
seek(int)
Moves the cursor to the specified position. position
must be a valid index of data_array.
void seek(int position)
Parameters
position
int