Files
godot-docs/classes/class_poolbytearray.rst
2017-08-02 20:06:36 +07:00

148 lines
9.8 KiB
ReStructuredText

.. 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_PoolByteArray:
PoolByteArray
=============
**Category:** Built-In Types
Brief Description
-----------------
Raw byte array.
Member Functions
----------------
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolByteArray<class_poolbytearray>` | :ref:`PoolByteArray<class_PoolByteArray_PoolByteArray>` **(** :ref:`Array<class_array>` from **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`append<class_PoolByteArray_append>` **(** :ref:`int<class_int>` byte **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`append_array<class_PoolByteArray_append_array>` **(** :ref:`PoolByteArray<class_poolbytearray>` array **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolByteArray<class_poolbytearray>` | :ref:`compress<class_PoolByteArray_compress>` **(** :ref:`int<class_int>` compression_mode=0 **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolByteArray<class_poolbytearray>` | :ref:`decompress<class_PoolByteArray_decompress>` **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_string>` | :ref:`get_string_from_ascii<class_PoolByteArray_get_string_from_ascii>` **(** **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_string>` | :ref:`get_string_from_utf8<class_PoolByteArray_get_string_from_utf8>` **(** **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`insert<class_PoolByteArray_insert>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`invert<class_PoolByteArray_invert>` **(** **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`push_back<class_PoolByteArray_push_back>` **(** :ref:`int<class_int>` byte **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`remove<class_PoolByteArray_remove>` **(** :ref:`int<class_int>` idx **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`resize<class_PoolByteArray_resize>` **(** :ref:`int<class_int>` idx **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set<class_PoolByteArray_set>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`size<class_PoolByteArray_size>` **(** **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolByteArray<class_poolbytearray>` | :ref:`subarray<class_PoolByteArray_subarray>` **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)** |
+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
Description
-----------
Raw byte array. Contains bytes. Optimized for memory usage, can't fragment the memory.
Member Function Description
---------------------------
.. _class_PoolByteArray_PoolByteArray:
- :ref:`PoolByteArray<class_poolbytearray>` **PoolByteArray** **(** :ref:`Array<class_array>` from **)**
Create from a generic array.
.. _class_PoolByteArray_append:
- void **append** **(** :ref:`int<class_int>` byte **)**
.. _class_PoolByteArray_append_array:
- void **append_array** **(** :ref:`PoolByteArray<class_poolbytearray>` array **)**
Append an :ref:`PoolByteArray<class_poolbytearray>` at the end of this array.
.. _class_PoolByteArray_compress:
- :ref:`PoolByteArray<class_poolbytearray>` **compress** **(** :ref:`int<class_int>` compression_mode=0 **)**
Returns a new :ref:`PoolByteArray<class_poolbytearray>` with the data compressed. The compression mode can be set using one of the COMPRESS\_\* constants of :ref:`File<class_file>`.
.. _class_PoolByteArray_decompress:
- :ref:`PoolByteArray<class_poolbytearray>` **decompress** **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)**
Returns a new :ref:`PoolByteArray<class_poolbytearray>` with the data decompressed. The buffer_size should be set as the size of the uncompressed data. The compression mode can be set using one of the COMPRESS\_\* constants of :ref:`File<class_file>`.
.. _class_PoolByteArray_get_string_from_ascii:
- :ref:`String<class_string>` **get_string_from_ascii** **(** **)**
Returns a copy of the array's contents formatted as String. Fast alternative to get_string_from_utf8(), assuming the content is ASCII-only (unlike the UTF-8 function, this function maps every byte to a character in the string, so any multibyte sequence will be torn apart).
.. _class_PoolByteArray_get_string_from_utf8:
- :ref:`String<class_string>` **get_string_from_utf8** **(** **)**
Returns a copy of the array's contents formatted as String, assuming the array is formatted as UTF-8. Slower than get_string_from_ascii(), but works for UTF-8. Usually you should prefer this function over get_string_from_ascii() to support international input.
.. _class_PoolByteArray_insert:
- :ref:`int<class_int>` **insert** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)**
Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
.. _class_PoolByteArray_invert:
- void **invert** **(** **)**
Reverse the order of the elements in the array (so first element will now be the last).
.. _class_PoolByteArray_push_back:
- void **push_back** **(** :ref:`int<class_int>` byte **)**
Append an element at the end of the array.
.. _class_PoolByteArray_remove:
- void **remove** **(** :ref:`int<class_int>` idx **)**
Remove an element from the array by index.
.. _class_PoolByteArray_resize:
- void **resize** **(** :ref:`int<class_int>` idx **)**
Set the size of the :ref:`PoolByteArray<class_poolbytearray>`. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
.. _class_PoolByteArray_set:
- void **set** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)**
Change the byte at the given index.
.. _class_PoolByteArray_size:
- :ref:`int<class_int>` **size** **(** **)**
Return the size of the array.
.. _class_PoolByteArray_subarray:
- :ref:`PoolByteArray<class_poolbytearray>` **subarray** **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)**
Returns the slice of the :ref:`PoolByteArray<class_poolbytearray>` between indices (inclusive) as a new :ref:`PoolByteArray<class_poolbytearray>`. Any negative index is considered to be from the end of the array.