:github_url: hide .. _class_StreamPeerBuffer: StreamPeerBuffer ================ **Eredita:** :ref:`StreamPeer` **<** :ref:`RefCounted` **<** :ref:`Object` Un peer di flusso utilizzato per gestire flussi di dati binari. .. rst-class:: classref-introduction-group Descrizione ---------------------- Un peer di flusso di buffer di dati che utilizza un array di byte come flusso. Questo oggetto può essere utilizzato per gestire i dati binari da sessioni di rete. Per gestire i dati binari memorizzati nei file, è possibile usare direttamente :ref:`FileAccess`. Un oggetto **StreamPeerBuffer** mantiene un cursore interno che è l'offset in byte all'inizio del buffer. Le operazioni Get e Put vengono eseguite nella posizione del cursore e sposteranno il cursore di conseguenza. .. rst-class:: classref-reftable-group Proprietà ------------------ .. table:: :widths: auto +-----------------------------------------------+---------------------------------------------------------------+-----------------------+ | :ref:`PackedByteArray` | :ref:`data_array` | ``PackedByteArray()`` | +-----------------------------------------------+---------------------------------------------------------------+-----------------------+ .. rst-class:: classref-reftable-group Metodi ------------ .. 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`\ (\ size\: :ref:`int`\ ) | +-------------------------------------------------+-----------------------------------------------------------------------------------------+ | |void| | :ref:`seek`\ (\ position\: :ref:`int`\ ) | +-------------------------------------------------+-----------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Descrizioni delle proprietà ------------------------------------------------------ .. _class_StreamPeerBuffer_property_data_array: .. rst-class:: classref-property :ref:`PackedByteArray` **data_array** = ``PackedByteArray()`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_data_array**\ (\ value\: :ref:`PackedByteArray`\ ) - :ref:`PackedByteArray` **get_data_array**\ (\ ) Il buffer di dati sottostante. Impostare questo valore ripristina la posizione del cursore. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedByteArray` for more details. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Descrizioni dei metodi -------------------------------------------- .. _class_StreamPeerBuffer_method_clear: .. rst-class:: classref-method |void| **clear**\ (\ ) :ref:`🔗` Cancella l':ref:`data_array` e ripristina il cursore. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_duplicate: .. rst-class:: classref-method :ref:`StreamPeerBuffer` **duplicate**\ (\ ) |const| :ref:`🔗` Restituisce un nuovo **StreamPeerBuffer** con lo stesso contenuto di :ref:`data_array`. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_get_position: .. rst-class:: classref-method :ref:`int` **get_position**\ (\ ) |const| :ref:`🔗` Restituisce la posizione attuale del cursore. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_get_size: .. rst-class:: classref-method :ref:`int` **get_size**\ (\ ) |const| :ref:`🔗` Restituisce la dimensione di :ref:`data_array`. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_resize: .. rst-class:: classref-method |void| **resize**\ (\ size\: :ref:`int`\ ) :ref:`🔗` Ridimensiona l':ref:`data_array`. Questo metodo *non* aggiorna il cursore. .. rst-class:: classref-item-separator ---- .. _class_StreamPeerBuffer_method_seek: .. rst-class:: classref-method |void| **seek**\ (\ position\: :ref:`int`\ ) :ref:`🔗` Sposta il cursore nella posizione specificata. ``position`` deve essere un indice valido di :ref:`data_array`. .. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)` .. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)` .. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)` .. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)` .. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)` .. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)` .. |void| replace:: :abbr:`void (Nessun valore restituito.)`