123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
- .. _class_StreamPeer:
- StreamPeer
- ==========
- **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
- **Inherited By:** :ref:`StreamPeerBuffer<class_streampeerbuffer>`, :ref:`StreamPeerSSL<class_streampeerssl>`, :ref:`StreamPeerTCP<class_streampeertcp>`
- **Category:** Core
- Brief Description
- -----------------
- Abstraction and base class for stream-based protocols.
- Member Functions
- ----------------
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_16<class_StreamPeer_get_16>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_32<class_StreamPeer_get_32>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_64<class_StreamPeer_get_64>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_8<class_StreamPeer_get_8>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_available_bytes<class_StreamPeer_get_available_bytes>` **(** **)** const |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`Array<class_array>` | :ref:`get_data<class_StreamPeer_get_data>` **(** :ref:`int<class_int>` bytes **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_double<class_StreamPeer_get_double>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_float<class_StreamPeer_get_float>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`Array<class_array>` | :ref:`get_partial_data<class_StreamPeer_get_partial_data>` **(** :ref:`int<class_int>` bytes **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_string<class_StreamPeer_get_string>` **(** :ref:`int<class_int>` bytes **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_u16<class_StreamPeer_get_u16>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_u32<class_StreamPeer_get_u32>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_u64<class_StreamPeer_get_u64>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_u8<class_StreamPeer_get_u8>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_utf8_string<class_StreamPeer_get_utf8_string>` **(** :ref:`int<class_int>` bytes **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_variant>` | :ref:`get_var<class_StreamPeer_get_var>` **(** **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_big_endian_enabled<class_StreamPeer_is_big_endian_enabled>` **(** **)** const |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_16<class_StreamPeer_put_16>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_32<class_StreamPeer_put_32>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_64<class_StreamPeer_put_64>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_8<class_StreamPeer_put_8>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`put_data<class_StreamPeer_put_data>` **(** :ref:`RawArray<class_rawarray>` data **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_double<class_StreamPeer_put_double>` **(** :ref:`float<class_float>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_float<class_StreamPeer_put_float>` **(** :ref:`float<class_float>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`Array<class_array>` | :ref:`put_partial_data<class_StreamPeer_put_partial_data>` **(** :ref:`RawArray<class_rawarray>` data **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_u16<class_StreamPeer_put_u16>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_u32<class_StreamPeer_put_u32>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_u64<class_StreamPeer_put_u64>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_u8<class_StreamPeer_put_u8>` **(** :ref:`int<class_int>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_utf8_string<class_StreamPeer_put_utf8_string>` **(** :ref:`String<class_string>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`put_var<class_StreamPeer_put_var>` **(** :ref:`Variant<class_variant>` val **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_big_endian<class_StreamPeer_set_big_endian>` **(** :ref:`bool<class_bool>` enable **)** |
- +--------------------------------+---------------------------------------------------------------------------------------------------------------+
- Description
- -----------
- StreamPeer is an abstraction and base class for stream-based protocols (such as TCP or Unix Sockets). It provides an API for sending and receiving data through streams as raw data or strings.
- Member Function Description
- ---------------------------
- .. _class_StreamPeer_get_16:
- - :ref:`int<class_int>` **get_16** **(** **)**
- Get a signed 16 bit value from the stream.
- .. _class_StreamPeer_get_32:
- - :ref:`int<class_int>` **get_32** **(** **)**
- Get a signed 32 bit value from the stream.
- .. _class_StreamPeer_get_64:
- - :ref:`int<class_int>` **get_64** **(** **)**
- Get a signed 64 bit value from the stream.
- .. _class_StreamPeer_get_8:
- - :ref:`int<class_int>` **get_8** **(** **)**
- Get a signed byte from the stream.
- .. _class_StreamPeer_get_available_bytes:
- - :ref:`int<class_int>` **get_available_bytes** **(** **)** const
- Return the amount of bytes this :ref:`StreamPeer<class_streampeer>` has available.
- .. _class_StreamPeer_get_data:
- - :ref:`Array<class_array>` **get_data** **(** :ref:`int<class_int>` bytes **)**
- Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will block until the desired amount is received. This function returns two values, an Error code and a data array.
- .. _class_StreamPeer_get_double:
- - :ref:`float<class_float>` **get_double** **(** **)**
- Get a double-precision float from the stream.
- .. _class_StreamPeer_get_float:
- - :ref:`float<class_float>` **get_float** **(** **)**
- Get a single-precision float from the stream.
- .. _class_StreamPeer_get_partial_data:
- - :ref:`Array<class_array>` **get_partial_data** **(** :ref:`int<class_int>` bytes **)**
- Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an Error code, and a data array.
- .. _class_StreamPeer_get_string:
- - :ref:`String<class_string>` **get_string** **(** :ref:`int<class_int>` bytes **)**
- Get a string with byte-length "bytes" from the stream.
- .. _class_StreamPeer_get_u16:
- - :ref:`int<class_int>` **get_u16** **(** **)**
- Get an unsigned 16 bit value from the stream.
- .. _class_StreamPeer_get_u32:
- - :ref:`int<class_int>` **get_u32** **(** **)**
- Get an unsigned 32 bit value from the stream.
- .. _class_StreamPeer_get_u64:
- - :ref:`int<class_int>` **get_u64** **(** **)**
- Get an unsigned 16 bit value from the stream.
- .. _class_StreamPeer_get_u8:
- - :ref:`int<class_int>` **get_u8** **(** **)**
- Get an unsigned byte from the stream.
- .. _class_StreamPeer_get_utf8_string:
- - :ref:`String<class_string>` **get_utf8_string** **(** :ref:`int<class_int>` bytes **)**
- Get an utf8 string with byte-length "bytes" from the stream (this decodes the string sent as utf8).
- .. _class_StreamPeer_get_var:
- - :ref:`Variant<class_variant>` **get_var** **(** **)**
- Get a Variant from the stream.
- .. _class_StreamPeer_is_big_endian_enabled:
- - :ref:`bool<class_bool>` **is_big_endian_enabled** **(** **)** const
- Return whether this :ref:`StreamPeer<class_streampeer>` is using big-endian format.
- .. _class_StreamPeer_put_16:
- - void **put_16** **(** :ref:`int<class_int>` val **)**
- Put a signed 16 bit value into the stream.
- .. _class_StreamPeer_put_32:
- - void **put_32** **(** :ref:`int<class_int>` val **)**
- Put a signed 32 bit value into the stream.
- .. _class_StreamPeer_put_64:
- - void **put_64** **(** :ref:`int<class_int>` val **)**
- Put a signed 64 bit value into the stream.
- .. _class_StreamPeer_put_8:
- - void **put_8** **(** :ref:`int<class_int>` val **)**
- Put a signed byte into the stream.
- .. _class_StreamPeer_put_data:
- - :ref:`int<class_int>` **put_data** **(** :ref:`RawArray<class_rawarray>` data **)**
- Send a chunk of data through the connection, blocking if necessary until the data is done sending. This function returns an Error code.
- .. _class_StreamPeer_put_double:
- - void **put_double** **(** :ref:`float<class_float>` val **)**
- Put a double-precision float into the stream.
- .. _class_StreamPeer_put_float:
- - void **put_float** **(** :ref:`float<class_float>` val **)**
- Put a single-precision float into the stream.
- .. _class_StreamPeer_put_partial_data:
- - :ref:`Array<class_array>` **put_partial_data** **(** :ref:`RawArray<class_rawarray>` data **)**
- Send a chunk of data through the connection, if all the data could not be sent at once, only part of it will. This function returns two values, an Error code and an integer, describing how much data was actually sent.
- .. _class_StreamPeer_put_u16:
- - void **put_u16** **(** :ref:`int<class_int>` val **)**
- Put an unsigned 16 bit value into the stream.
- .. _class_StreamPeer_put_u32:
- - void **put_u32** **(** :ref:`int<class_int>` val **)**
- Put an unsigned 32 bit value into the stream.
- .. _class_StreamPeer_put_u64:
- - void **put_u64** **(** :ref:`int<class_int>` val **)**
- Put an unsigned 64 bit value into the stream.
- .. _class_StreamPeer_put_u8:
- - void **put_u8** **(** :ref:`int<class_int>` val **)**
- Put an unsigned byte into the stream.
- .. _class_StreamPeer_put_utf8_string:
- - void **put_utf8_string** **(** :ref:`String<class_string>` val **)**
- Put a zero-terminated utf8 string into the stream.
- .. _class_StreamPeer_put_var:
- - void **put_var** **(** :ref:`Variant<class_variant>` val **)**
- Put a Variant into the stream.
- .. _class_StreamPeer_set_big_endian:
- - void **set_big_endian** **(** :ref:`bool<class_bool>` enable **)**
- Set this :ref:`StreamPeer<class_streampeer>` to use big-endian format. Default is false.
|