mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
Currently including `zh_CN` and `es` which both have very high completion ratios. Others will be added once they reach a significant percentage too. These RST files will be used by godot-docs in place of its `classes` folder after we sync with https://github.com/godotengine/godot-docs/pull/5458. The update workflow is manual for now (example for `zh_CN`): - Build `godotengine/godot` in the branch we currently track (now `3.x`) - Run `godot --doctool -l zh_CN` - Run `cd doc && make rst LANGARG=zh_CN` - Copy `doc/_build/rst/*` to `classes/zh_CN/` here - Make sure to have `classes/zh_CN/index.rst` copied from `docs/classes`
223 lines
14 KiB
ReStructuredText
223 lines
14 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the PoolByteArray.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_PoolByteArray:
|
|
|
|
PoolByteArray
|
|
=============
|
|
|
|
A pooled :ref:`Array<class_Array>` of bytes.
|
|
|
|
Descripción
|
|
----------------------
|
|
|
|
An :ref:`Array<class_Array>` specifically designed to hold bytes. Optimized for memory usage, does not fragment the memory.
|
|
|
|
\ **Note:** This type is passed by value and not by reference.
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`PoolByteArray<class_PoolByteArray_method_PoolByteArray>` **(** :ref:`Array<class_Array>` from **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`append<class_PoolByteArray_method_append>` **(** :ref:`int<class_int>` byte **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`append_array<class_PoolByteArray_method_append_array>` **(** :ref:`PoolByteArray<class_PoolByteArray>` array **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`compress<class_PoolByteArray_method_compress>` **(** :ref:`int<class_int>` compression_mode=0 **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`decompress<class_PoolByteArray_method_decompress>` **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`decompress_dynamic<class_PoolByteArray_method_decompress_dynamic>` **(** :ref:`int<class_int>` max_output_size, :ref:`int<class_int>` compression_mode=0 **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`empty<class_PoolByteArray_method_empty>` **(** **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`get_string_from_ascii<class_PoolByteArray_method_get_string_from_ascii>` **(** **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`get_string_from_utf8<class_PoolByteArray_method_get_string_from_utf8>` **(** **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`hex_encode<class_PoolByteArray_method_hex_encode>` **(** **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`insert<class_PoolByteArray_method_insert>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`invert<class_PoolByteArray_method_invert>` **(** **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`push_back<class_PoolByteArray_method_push_back>` **(** :ref:`int<class_int>` byte **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`remove<class_PoolByteArray_method_remove>` **(** :ref:`int<class_int>` idx **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`resize<class_PoolByteArray_method_resize>` **(** :ref:`int<class_int>` idx **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set<class_PoolByteArray_method_set>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`size<class_PoolByteArray_method_size>` **(** **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`subarray<class_PoolByteArray_method_subarray>` **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_PoolByteArray_method_PoolByteArray:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **PoolByteArray** **(** :ref:`Array<class_Array>` from **)**
|
|
|
|
Constructs a new ``PoolByteArray``. Optionally, you can pass in a generic :ref:`Array<class_Array>` that will be converted.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_append:
|
|
|
|
- void **append** **(** :ref:`int<class_int>` byte **)**
|
|
|
|
Concatena un elemento al final del array (alias de :ref:`push_back<class_PoolByteArray_method_push_back>`).
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_append_array:
|
|
|
|
- void **append_array** **(** :ref:`PoolByteArray<class_PoolByteArray>` array **)**
|
|
|
|
Appends a ``PoolByteArray`` at the end of this array.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_compress:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **compress** **(** :ref:`int<class_int>` compression_mode=0 **)**
|
|
|
|
Returns a new ``PoolByteArray`` with the data compressed. Set the compression mode using one of :ref:`CompressionMode<enum_File_CompressionMode>`'s constants.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_decompress:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **decompress** **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)**
|
|
|
|
Returns a new ``PoolByteArray`` with the data decompressed. Set ``buffer_size`` to the size of the uncompressed data. Set the compression mode using one of :ref:`CompressionMode<enum_File_CompressionMode>`'s constants.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_decompress_dynamic:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **decompress_dynamic** **(** :ref:`int<class_int>` max_output_size, :ref:`int<class_int>` compression_mode=0 **)**
|
|
|
|
Returns a new ``PoolByteArray`` with the data decompressed. Set the compression mode using one of :ref:`CompressionMode<enum_File_CompressionMode>`'s constants. **This method only accepts gzip and deflate compression modes.**\
|
|
|
|
This method is potentially slower than ``decompress``, as it may have to re-allocate it's output buffer multiple times while decompressing, where as ``decompress`` knows it's output buffer size from the begining.
|
|
|
|
|
|
|
|
GZIP has a maximal compression ratio of 1032:1, meaning it's very possible for a small compressed payload to decompress to a potentially very large output. To guard against this, you may provide a maximum size this function is allowed to allocate in bytes via ``max_output_size``. Passing -1 will allow for unbounded output. If any positive value is passed, and the decompression exceeds that ammount in bytes, then an error will be returned.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_empty:
|
|
|
|
- :ref:`bool<class_bool>` **empty** **(** **)**
|
|
|
|
Devuelve ``true`` si el array es vacio.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_get_string_from_ascii:
|
|
|
|
- :ref:`String<class_String>` **get_string_from_ascii** **(** **)**
|
|
|
|
Devuelve una copia del contenido del array como :ref:`String<class_String>`. Alternativa rápida al :ref:`get_string_from_utf8<class_PoolByteArray_method_get_string_from_utf8>` si el contenido es sólo ASCII. A diferencia de la función UTF-8, esta función asigna cada byte a un carácter del array. Las secuencias multibyte no se interpretarán correctamente. Para analizar la entrada del usuario siempre usa :ref:`get_string_from_utf8<class_PoolByteArray_method_get_string_from_utf8>`.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_get_string_from_utf8:
|
|
|
|
- :ref:`String<class_String>` **get_string_from_utf8** **(** **)**
|
|
|
|
Devuelve una copia del contenido del array como :ref:`String<class_String>`. Más lento que :ref:`get_string_from_ascii<class_PoolByteArray_method_get_string_from_ascii>` pero soporta datos codificados en UTF-8. Utiliza esta función si no estás seguro de la fuente de los datos. Para la entrada del usuario esta función siempre debe ser preferida.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_hex_encode:
|
|
|
|
- :ref:`String<class_String>` **hex_encode** **(** **)**
|
|
|
|
Returns a hexadecimal representation of this array as a :ref:`String<class_String>`.
|
|
|
|
::
|
|
|
|
var array = PoolByteArray([11, 46, 255])
|
|
print(array.hex_encode()) # Prints: 0b2eff
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_insert:
|
|
|
|
- :ref:`int<class_int>` **insert** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)**
|
|
|
|
Inserta un nuevo elemento en una posición determinada del array. La posición debe ser válida, o al final del array (``idx == size()``).
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_invert:
|
|
|
|
- void **invert** **(** **)**
|
|
|
|
Invierte el orden de los elementos en el array.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_push_back:
|
|
|
|
- void **push_back** **(** :ref:`int<class_int>` byte **)**
|
|
|
|
Concatena un elemen al final del array.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_remove:
|
|
|
|
- void **remove** **(** :ref:`int<class_int>` idx **)**
|
|
|
|
Elimina un elemento del array por indice.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_resize:
|
|
|
|
- void **resize** **(** :ref:`int<class_int>` idx **)**
|
|
|
|
Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
|
|
|
|
\ **Note:** Added elements are not automatically initialized to 0 and will contain garbage, i.e. indeterminate values.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_set:
|
|
|
|
- void **set** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` byte **)**
|
|
|
|
Cambia el byte en el índice dado.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_size:
|
|
|
|
- :ref:`int<class_int>` **size** **(** **)**
|
|
|
|
Devuelve el tamaño del array.
|
|
|
|
----
|
|
|
|
.. _class_PoolByteArray_method_subarray:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **subarray** **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)**
|
|
|
|
Returns the slice of the ``PoolByteArray`` between indices (inclusive) as a new ``PoolByteArray``. Any negative index is considered to be from the end of the 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.)`
|