:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/StreamPeerBuffer.xml. .. _class_StreamPeerBuffer: StreamPeerBuffer ================ **Inherits:** :ref:`StreamPeer` **<** :ref:`Reference` **<** :ref:`Object` Data buffer stream peer. .. rst-class:: classref-introduction-group Description ----------- 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, :ref:`File` 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. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------------------------+---------------------------------------------------------------+-----------------------+ | :ref:`PoolByteArray` | :ref:`data_array` | ``PoolByteArray( )`` | +-------------------------------------------+---------------------------------------------------------------+-----------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------------------------+--------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +-------------------------------------------------+--------------------------------------------------------------------------------------------+ | :ref:`StreamPeerBuffer` | :ref:`duplicate` **(** **)** |const| | +-------------------------------------------------+--------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_position` **(** **)** |const| | +-------------------------------------------------+--------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_size` **(** **)** |const| | +-------------------------------------------------+--------------------------------------------------------------------------------------------+ | void | :ref:`resize` **(** :ref:`int` size **)** | +-------------------------------------------------+--------------------------------------------------------------------------------------------+ | void | :ref:`seek` **(** :ref:`int` position **)** | +-------------------------------------------------+--------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_StreamPeerBuffer_property_data_array: .. rst-class:: classref-property :ref:`PoolByteArray` **data_array** = ``PoolByteArray( )`` .. rst-class:: classref-property-setget - void **set_data_array** **(** :ref:`PoolByteArray` value **)** - :ref:`PoolByteArray` **get_data_array** **(** **)** The underlying data buffer. Setting this value resets the cursor. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_StreamPeerBuffer_method_clear: .. rst-class:: classref-method void **clear** **(** **)** Clears the :ref:`data_array` and resets the cursor. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_duplicate: .. rst-class:: classref-method :ref:`StreamPeerBuffer` **duplicate** **(** **)** |const| Returns a new **StreamPeerBuffer** with the same :ref:`data_array` content. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_get_position: .. rst-class:: classref-method :ref:`int` **get_position** **(** **)** |const| Returns the current cursor position. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_get_size: .. rst-class:: classref-method :ref:`int` **get_size** **(** **)** |const| Returns the size of :ref:`data_array`. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_resize: .. rst-class:: classref-method void **resize** **(** :ref:`int` size **)** Resizes the :ref:`data_array`. This *doesn't* update the cursor. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_seek: .. rst-class:: classref-method void **seek** **(** :ref:`int` position **)** Moves the cursor to the specified position. ``position`` must be a valid index of :ref:`data_array`. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`