123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/PackedByteArray.xml.
- .. _class_PackedByteArray:
- PackedByteArray
- ===============
- A packed array of bytes.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- An array specifically designed to hold bytes. Packs data tightly, so it saves memory for large array sizes.
- \ **PackedByteArray** also provides methods to encode/decode various types to/from bytes. The way values are encoded is an implementation detail and shouldn't be relied upon when interacting with external apps.
- .. note::
- There are notable differences when using this API with C#. See :ref:`doc_c_sharp_differences` for more information.
- .. rst-class:: classref-reftable-group
- Constructors
- ------------
- .. table::
- :widths: auto
- +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`PackedByteArray<class_PackedByteArray_constructor_PackedByteArray>` **(** **)** |
- +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`PackedByteArray<class_PackedByteArray_constructor_PackedByteArray>` **(** :ref:`PackedByteArray<class_PackedByteArray>` from **)** |
- +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`PackedByteArray<class_PackedByteArray_constructor_PackedByteArray>` **(** :ref:`Array<class_Array>` from **)** |
- +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`append<class_PackedByteArray_method_append>` **(** :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`append_array<class_PackedByteArray_method_append_array>` **(** :ref:`PackedByteArray<class_PackedByteArray>` array **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`bsearch<class_PackedByteArray_method_bsearch>` **(** :ref:`int<class_int>` value, :ref:`bool<class_bool>` before=true **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear<class_PackedByteArray_method_clear>` **(** **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`compress<class_PackedByteArray_method_compress>` **(** :ref:`int<class_int>` compression_mode=0 **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`count<class_PackedByteArray_method_count>` **(** :ref:`int<class_int>` value **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`decode_double<class_PackedByteArray_method_decode_double>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`decode_float<class_PackedByteArray_method_decode_float>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`decode_half<class_PackedByteArray_method_decode_half>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_s8<class_PackedByteArray_method_decode_s8>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_s16<class_PackedByteArray_method_decode_s16>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_s32<class_PackedByteArray_method_decode_s32>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_s64<class_PackedByteArray_method_decode_s64>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_u8<class_PackedByteArray_method_decode_u8>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_u16<class_PackedByteArray_method_decode_u16>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_u32<class_PackedByteArray_method_decode_u32>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_u64<class_PackedByteArray_method_decode_u64>` **(** :ref:`int<class_int>` byte_offset **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_Variant>` | :ref:`decode_var<class_PackedByteArray_method_decode_var>` **(** :ref:`int<class_int>` byte_offset, :ref:`bool<class_bool>` allow_objects=false **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`decode_var_size<class_PackedByteArray_method_decode_var_size>` **(** :ref:`int<class_int>` byte_offset, :ref:`bool<class_bool>` allow_objects=false **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`decompress<class_PackedByteArray_method_decompress>` **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`decompress_dynamic<class_PackedByteArray_method_decompress_dynamic>` **(** :ref:`int<class_int>` max_output_size, :ref:`int<class_int>` compression_mode=0 **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`duplicate<class_PackedByteArray_method_duplicate>` **(** **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_double<class_PackedByteArray_method_encode_double>` **(** :ref:`int<class_int>` byte_offset, :ref:`float<class_float>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_float<class_PackedByteArray_method_encode_float>` **(** :ref:`int<class_int>` byte_offset, :ref:`float<class_float>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_half<class_PackedByteArray_method_encode_half>` **(** :ref:`int<class_int>` byte_offset, :ref:`float<class_float>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_s8<class_PackedByteArray_method_encode_s8>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_s16<class_PackedByteArray_method_encode_s16>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_s32<class_PackedByteArray_method_encode_s32>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_s64<class_PackedByteArray_method_encode_s64>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_u8<class_PackedByteArray_method_encode_u8>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_u16<class_PackedByteArray_method_encode_u16>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_u32<class_PackedByteArray_method_encode_u32>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`encode_u64<class_PackedByteArray_method_encode_u64>` **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`encode_var<class_PackedByteArray_method_encode_var>` **(** :ref:`int<class_int>` byte_offset, :ref:`Variant<class_Variant>` value, :ref:`bool<class_bool>` allow_objects=false **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`fill<class_PackedByteArray_method_fill>` **(** :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`find<class_PackedByteArray_method_find>` **(** :ref:`int<class_int>` value, :ref:`int<class_int>` from=0 **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_string_from_ascii<class_PackedByteArray_method_get_string_from_ascii>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_string_from_utf8<class_PackedByteArray_method_get_string_from_utf8>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_string_from_utf16<class_PackedByteArray_method_get_string_from_utf16>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_string_from_utf32<class_PackedByteArray_method_get_string_from_utf32>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_string_from_wchar<class_PackedByteArray_method_get_string_from_wchar>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has<class_PackedByteArray_method_has>` **(** :ref:`int<class_int>` value **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_encoded_var<class_PackedByteArray_method_has_encoded_var>` **(** :ref:`int<class_int>` byte_offset, :ref:`bool<class_bool>` allow_objects=false **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`hex_encode<class_PackedByteArray_method_hex_encode>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`insert<class_PackedByteArray_method_insert>` **(** :ref:`int<class_int>` at_index, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_empty<class_PackedByteArray_method_is_empty>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`push_back<class_PackedByteArray_method_push_back>` **(** :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_at<class_PackedByteArray_method_remove_at>` **(** :ref:`int<class_int>` index **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`resize<class_PackedByteArray_method_resize>` **(** :ref:`int<class_int>` new_size **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`reverse<class_PackedByteArray_method_reverse>` **(** **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`rfind<class_PackedByteArray_method_rfind>` **(** :ref:`int<class_int>` value, :ref:`int<class_int>` from=-1 **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set<class_PackedByteArray_method_set>` **(** :ref:`int<class_int>` index, :ref:`int<class_int>` value **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`size<class_PackedByteArray_method_size>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`slice<class_PackedByteArray_method_slice>` **(** :ref:`int<class_int>` begin, :ref:`int<class_int>` end=2147483647 **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`sort<class_PackedByteArray_method_sort>` **(** **)** |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`to_float32_array<class_PackedByteArray_method_to_float32_array>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedFloat64Array<class_PackedFloat64Array>` | :ref:`to_float64_array<class_PackedByteArray_method_to_float64_array>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`to_int32_array<class_PackedByteArray_method_to_int32_array>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedInt64Array<class_PackedInt64Array>` | :ref:`to_int64_array<class_PackedByteArray_method_to_int64_array>` **(** **)** |const| |
- +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-reftable-group
- Operators
- ---------
- .. table::
- :widths: auto
- +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`operator !=<class_PackedByteArray_operator_neq_PackedByteArray>` **(** :ref:`PackedByteArray<class_PackedByteArray>` right **)** |
- +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`operator +<class_PackedByteArray_operator_sum_PackedByteArray>` **(** :ref:`PackedByteArray<class_PackedByteArray>` right **)** |
- +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`operator ==<class_PackedByteArray_operator_eq_PackedByteArray>` **(** :ref:`PackedByteArray<class_PackedByteArray>` right **)** |
- +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`operator []<class_PackedByteArray_operator_idx_int>` **(** :ref:`int<class_int>` index **)** |
- +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Constructor Descriptions
- ------------------------
- .. _class_PackedByteArray_constructor_PackedByteArray:
- .. rst-class:: classref-constructor
- :ref:`PackedByteArray<class_PackedByteArray>` **PackedByteArray** **(** **)**
- Constructs an empty **PackedByteArray**.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`PackedByteArray<class_PackedByteArray>` **PackedByteArray** **(** :ref:`PackedByteArray<class_PackedByteArray>` from **)**
- Constructs a **PackedByteArray** as a copy of the given **PackedByteArray**.
- .. rst-class:: classref-item-separator
- ----
- .. rst-class:: classref-constructor
- :ref:`PackedByteArray<class_PackedByteArray>` **PackedByteArray** **(** :ref:`Array<class_Array>` from **)**
- Constructs a new **PackedByteArray**. Optionally, you can pass in a generic :ref:`Array<class_Array>` that will be converted.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_PackedByteArray_method_append:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **append** **(** :ref:`int<class_int>` value **)**
- Appends an element at the end of the array (alias of :ref:`push_back<class_PackedByteArray_method_push_back>`).
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_append_array:
- .. rst-class:: classref-method
- void **append_array** **(** :ref:`PackedByteArray<class_PackedByteArray>` array **)**
- Appends a **PackedByteArray** at the end of this array.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_bsearch:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **bsearch** **(** :ref:`int<class_int>` value, :ref:`bool<class_bool>` before=true **)**
- Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a ``before`` specifier can be passed. If ``false``, the returned index comes after all existing entries of the value in the array.
- \ **Note:** Calling :ref:`bsearch<class_PackedByteArray_method_bsearch>` on an unsorted array results in unexpected behavior.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_clear:
- .. rst-class:: classref-method
- void **clear** **(** **)**
- Clears the array. This is equivalent to using :ref:`resize<class_PackedByteArray_method_resize>` with a size of ``0``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_compress:
- .. rst-class:: classref-method
- :ref:`PackedByteArray<class_PackedByteArray>` **compress** **(** :ref:`int<class_int>` compression_mode=0 **)** |const|
- Returns a new **PackedByteArray** with the data compressed. Set the compression mode using one of :ref:`CompressionMode<enum_FileAccess_CompressionMode>`'s constants.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_count:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **count** **(** :ref:`int<class_int>` value **)** |const|
- Returns the number of times an element is in the array.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_double:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **decode_double** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 64-bit floating point number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0.0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_float:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **decode_float** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 32-bit floating point number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0.0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_half:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **decode_half** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 16-bit floating point number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0.0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_s8:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_s8** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 8-bit signed integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_s16:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_s16** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 16-bit signed integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_s32:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_s32** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 32-bit signed integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_s64:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_s64** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 64-bit signed integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_u8:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_u8** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 8-bit unsigned integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_u16:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_u16** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 16-bit unsigned integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_u32:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_u32** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 32-bit unsigned integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_u64:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_u64** **(** :ref:`int<class_int>` byte_offset **)** |const|
- Decodes a 64-bit unsigned integer number from the bytes starting at ``byte_offset``. Fails if the byte count is insufficient. Returns ``0`` if a valid number can't be decoded.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_var:
- .. rst-class:: classref-method
- :ref:`Variant<class_Variant>` **decode_var** **(** :ref:`int<class_int>` byte_offset, :ref:`bool<class_bool>` allow_objects=false **)** |const|
- Decodes a :ref:`Variant<class_Variant>` from the bytes starting at ``byte_offset``. Returns ``null`` if a valid variant can't be decoded or the value is :ref:`Object<class_Object>`-derived and ``allow_objects`` is ``false``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decode_var_size:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **decode_var_size** **(** :ref:`int<class_int>` byte_offset, :ref:`bool<class_bool>` allow_objects=false **)** |const|
- Decodes a size of a :ref:`Variant<class_Variant>` from the bytes starting at ``byte_offset``. Requires at least 4 bytes of data starting at the offset, otherwise fails.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decompress:
- .. rst-class:: classref-method
- :ref:`PackedByteArray<class_PackedByteArray>` **decompress** **(** :ref:`int<class_int>` buffer_size, :ref:`int<class_int>` compression_mode=0 **)** |const|
- Returns a new **PackedByteArray** with the data decompressed. Set ``buffer_size`` to the size of the uncompressed data. Set the compression mode using one of :ref:`CompressionMode<enum_FileAccess_CompressionMode>`'s constants.
- \ **Note:** Decompression is not guaranteed to work with data not compressed by Godot, for example if data compressed with the deflate compression mode lacks a checksum or header.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_decompress_dynamic:
- .. rst-class:: classref-method
- :ref:`PackedByteArray<class_PackedByteArray>` **decompress_dynamic** **(** :ref:`int<class_int>` max_output_size, :ref:`int<class_int>` compression_mode=0 **)** |const|
- Returns a new **PackedByteArray** with the data decompressed. Set the compression mode using one of :ref:`CompressionMode<enum_FileAccess_CompressionMode>`'s constants. **This method only accepts brotli, gzip, and deflate compression modes.**\
- This method is potentially slower than :ref:`decompress<class_PackedByteArray_method_decompress>`, as it may have to re-allocate its output buffer multiple times while decompressing, whereas :ref:`decompress<class_PackedByteArray_method_decompress>` knows it's output buffer size from the beginning.
- 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 amount in bytes, then an error will be returned.
- \ **Note:** Decompression is not guaranteed to work with data not compressed by Godot, for example if data compressed with the deflate compression mode lacks a checksum or header.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_duplicate:
- .. rst-class:: classref-method
- :ref:`PackedByteArray<class_PackedByteArray>` **duplicate** **(** **)**
- Creates a copy of the array, and returns it.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_double:
- .. rst-class:: classref-method
- void **encode_double** **(** :ref:`int<class_int>` byte_offset, :ref:`float<class_float>` value **)**
- Encodes a 64-bit floating point number as bytes at the index of ``byte_offset`` bytes. The array must have at least 8 bytes of allocated space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_float:
- .. rst-class:: classref-method
- void **encode_float** **(** :ref:`int<class_int>` byte_offset, :ref:`float<class_float>` value **)**
- Encodes a 32-bit floating point number as bytes at the index of ``byte_offset`` bytes. The array must have at least 4 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_half:
- .. rst-class:: classref-method
- void **encode_half** **(** :ref:`int<class_int>` byte_offset, :ref:`float<class_float>` value **)**
- Encodes a 16-bit floating point number as bytes at the index of ``byte_offset`` bytes. The array must have at least 2 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_s8:
- .. rst-class:: classref-method
- void **encode_s8** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 8-bit signed integer number (signed byte) at the index of ``byte_offset`` bytes. The array must have at least 1 byte of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_s16:
- .. rst-class:: classref-method
- void **encode_s16** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 16-bit signed integer number as bytes at the index of ``byte_offset`` bytes. The array must have at least 2 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_s32:
- .. rst-class:: classref-method
- void **encode_s32** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 32-bit signed integer number as bytes at the index of ``byte_offset`` bytes. The array must have at least 4 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_s64:
- .. rst-class:: classref-method
- void **encode_s64** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 64-bit signed integer number as bytes at the index of ``byte_offset`` bytes. The array must have at least 8 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_u8:
- .. rst-class:: classref-method
- void **encode_u8** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 8-bit unsigned integer number (byte) at the index of ``byte_offset`` bytes. The array must have at least 1 byte of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_u16:
- .. rst-class:: classref-method
- void **encode_u16** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 16-bit unsigned integer number as bytes at the index of ``byte_offset`` bytes. The array must have at least 2 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_u32:
- .. rst-class:: classref-method
- void **encode_u32** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 32-bit unsigned integer number as bytes at the index of ``byte_offset`` bytes. The array must have at least 4 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_u64:
- .. rst-class:: classref-method
- void **encode_u64** **(** :ref:`int<class_int>` byte_offset, :ref:`int<class_int>` value **)**
- Encodes a 64-bit unsigned integer number as bytes at the index of ``byte_offset`` bytes. The array must have at least 8 bytes of space, starting at the offset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_encode_var:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **encode_var** **(** :ref:`int<class_int>` byte_offset, :ref:`Variant<class_Variant>` value, :ref:`bool<class_bool>` allow_objects=false **)**
- Encodes a :ref:`Variant<class_Variant>` at the index of ``byte_offset`` bytes. A sufficient space must be allocated, depending on the encoded variant's size. If ``allow_objects`` is ``false``, :ref:`Object<class_Object>`-derived values are not permitted and will instead be serialized as ID-only.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_fill:
- .. rst-class:: classref-method
- void **fill** **(** :ref:`int<class_int>` value **)**
- Assigns the given value to all elements in the array. This can typically be used together with :ref:`resize<class_PackedByteArray_method_resize>` to create an array with a given size and initialized elements.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_find:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **find** **(** :ref:`int<class_int>` value, :ref:`int<class_int>` from=0 **)** |const|
- Searches the array for a value and returns its index or ``-1`` if not found. Optionally, the initial search index can be passed.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_get_string_from_ascii:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_string_from_ascii** **(** **)** |const|
- Converts ASCII/Latin-1 encoded array to :ref:`String<class_String>`. Fast alternative to :ref:`get_string_from_utf8<class_PackedByteArray_method_get_string_from_utf8>` if the content is ASCII/Latin-1 only. Unlike the UTF-8 function this function maps every byte to a character in the array. Multibyte sequences will not be interpreted correctly. For parsing user input always use :ref:`get_string_from_utf8<class_PackedByteArray_method_get_string_from_utf8>`. This is the inverse of :ref:`String.to_ascii_buffer<class_String_method_to_ascii_buffer>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_get_string_from_utf8:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_string_from_utf8** **(** **)** |const|
- Converts UTF-8 encoded array to :ref:`String<class_String>`. Slower than :ref:`get_string_from_ascii<class_PackedByteArray_method_get_string_from_ascii>` but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred. Returns empty string if source array is not valid UTF-8 string. This is the inverse of :ref:`String.to_utf8_buffer<class_String_method_to_utf8_buffer>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_get_string_from_utf16:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_string_from_utf16** **(** **)** |const|
- Converts UTF-16 encoded array to :ref:`String<class_String>`. If the BOM is missing, system endianness is assumed. Returns empty string if source array is not valid UTF-16 string. This is the inverse of :ref:`String.to_utf16_buffer<class_String_method_to_utf16_buffer>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_get_string_from_utf32:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_string_from_utf32** **(** **)** |const|
- Converts UTF-32 encoded array to :ref:`String<class_String>`. System endianness is assumed. Returns empty string if source array is not valid UTF-32 string. This is the inverse of :ref:`String.to_utf32_buffer<class_String_method_to_utf32_buffer>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_get_string_from_wchar:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_string_from_wchar** **(** **)** |const|
- Converts wide character (``wchar_t``, UTF-16 on Windows, UTF-32 on other platforms) encoded array to :ref:`String<class_String>`. Returns empty string if source array is not valid wide string. This is the inverse of :ref:`String.to_wchar_buffer<class_String_method_to_wchar_buffer>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_has:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **has** **(** :ref:`int<class_int>` value **)** |const|
- Returns ``true`` if the array contains ``value``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_has_encoded_var:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **has_encoded_var** **(** :ref:`int<class_int>` byte_offset, :ref:`bool<class_bool>` allow_objects=false **)** |const|
- Returns ``true`` if a valid :ref:`Variant<class_Variant>` value can be decoded at the ``byte_offset``. Returns ``false`` otherwise or when the value is :ref:`Object<class_Object>`-derived and ``allow_objects`` is ``false``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_hex_encode:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **hex_encode** **(** **)** |const|
- Returns a hexadecimal representation of this array as a :ref:`String<class_String>`.
- .. tabs::
- .. code-tab:: gdscript
- var array = PackedByteArray([11, 46, 255])
- print(array.hex_encode()) # Prints: 0b2eff
- .. code-tab:: csharp
- var array = new byte[] {11, 46, 255};
- GD.Print(array.HexEncode()); // Prints: 0b2eff
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_insert:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **insert** **(** :ref:`int<class_int>` at_index, :ref:`int<class_int>` value **)**
- Inserts a new element at a given position in the array. The position must be valid, or at the end of the array (``idx == size()``).
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_is_empty:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_empty** **(** **)** |const|
- Returns ``true`` if the array is empty.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_push_back:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **push_back** **(** :ref:`int<class_int>` value **)**
- Appends an element at the end of the array.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_remove_at:
- .. rst-class:: classref-method
- void **remove_at** **(** :ref:`int<class_int>` index **)**
- Removes an element from the array by index.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_resize:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **resize** **(** :ref:`int<class_int>` new_size **)**
- 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. Calling :ref:`resize<class_PackedByteArray_method_resize>` once and assigning the new values is faster than adding new elements one by one.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_reverse:
- .. rst-class:: classref-method
- void **reverse** **(** **)**
- Reverses the order of the elements in the array.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_rfind:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **rfind** **(** :ref:`int<class_int>` value, :ref:`int<class_int>` from=-1 **)** |const|
- Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_set:
- .. rst-class:: classref-method
- void **set** **(** :ref:`int<class_int>` index, :ref:`int<class_int>` value **)**
- Changes the byte at the given index.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_size:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **size** **(** **)** |const|
- Returns the number of elements in the array.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_slice:
- .. rst-class:: classref-method
- :ref:`PackedByteArray<class_PackedByteArray>` **slice** **(** :ref:`int<class_int>` begin, :ref:`int<class_int>` end=2147483647 **)** |const|
- Returns the slice of the **PackedByteArray**, from ``begin`` (inclusive) to ``end`` (exclusive), as a new **PackedByteArray**.
- The absolute value of ``begin`` and ``end`` will be clamped to the array size, so the default value for ``end`` makes it slice to the size of the array by default (i.e. ``arr.slice(1)`` is a shorthand for ``arr.slice(1, arr.size())``).
- If either ``begin`` or ``end`` are negative, they will be relative to the end of the array (i.e. ``arr.slice(0, -2)`` is a shorthand for ``arr.slice(0, arr.size() - 2)``).
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_sort:
- .. rst-class:: classref-method
- void **sort** **(** **)**
- Sorts the elements of the array in ascending order.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_to_float32_array:
- .. rst-class:: classref-method
- :ref:`PackedFloat32Array<class_PackedFloat32Array>` **to_float32_array** **(** **)** |const|
- Returns a copy of the data converted to a :ref:`PackedFloat32Array<class_PackedFloat32Array>`, where each block of 4 bytes has been converted to a 32-bit float (C++ ``float``).
- The size of the input array must be a multiple of 4 (size of 32-bit float). The size of the new array will be ``byte_array.size() / 4``.
- If the original data can't be converted to 32-bit floats, the resulting data is undefined.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_to_float64_array:
- .. rst-class:: classref-method
- :ref:`PackedFloat64Array<class_PackedFloat64Array>` **to_float64_array** **(** **)** |const|
- Returns a copy of the data converted to a :ref:`PackedFloat64Array<class_PackedFloat64Array>`, where each block of 8 bytes has been converted to a 64-bit float (C++ ``double``, Godot :ref:`float<class_float>`).
- The size of the input array must be a multiple of 8 (size of 64-bit double). The size of the new array will be ``byte_array.size() / 8``.
- If the original data can't be converted to 64-bit floats, the resulting data is undefined.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_to_int32_array:
- .. rst-class:: classref-method
- :ref:`PackedInt32Array<class_PackedInt32Array>` **to_int32_array** **(** **)** |const|
- Returns a copy of the data converted to a :ref:`PackedInt32Array<class_PackedInt32Array>`, where each block of 4 bytes has been converted to a signed 32-bit integer (C++ ``int32_t``).
- The size of the input array must be a multiple of 4 (size of 32-bit integer). The size of the new array will be ``byte_array.size() / 4``.
- If the original data can't be converted to signed 32-bit integers, the resulting data is undefined.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_method_to_int64_array:
- .. rst-class:: classref-method
- :ref:`PackedInt64Array<class_PackedInt64Array>` **to_int64_array** **(** **)** |const|
- Returns a copy of the data converted to a :ref:`PackedInt64Array<class_PackedInt64Array>`, where each block of 8 bytes has been converted to a signed 64-bit integer (C++ ``int64_t``, Godot :ref:`int<class_int>`).
- The size of the input array must be a multiple of 8 (size of 64-bit integer). The size of the new array will be ``byte_array.size() / 8``.
- If the original data can't be converted to signed 64-bit integers, the resulting data is undefined.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Operator Descriptions
- ---------------------
- .. _class_PackedByteArray_operator_neq_PackedByteArray:
- .. rst-class:: classref-operator
- :ref:`bool<class_bool>` **operator !=** **(** :ref:`PackedByteArray<class_PackedByteArray>` right **)**
- Returns ``true`` if contents of the arrays differ.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_operator_sum_PackedByteArray:
- .. rst-class:: classref-operator
- :ref:`PackedByteArray<class_PackedByteArray>` **operator +** **(** :ref:`PackedByteArray<class_PackedByteArray>` right **)**
- Returns a new **PackedByteArray** with contents of ``right`` added at the end of this array. For better performance, consider using :ref:`append_array<class_PackedByteArray_method_append_array>` instead.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_operator_eq_PackedByteArray:
- .. rst-class:: classref-operator
- :ref:`bool<class_bool>` **operator ==** **(** :ref:`PackedByteArray<class_PackedByteArray>` right **)**
- Returns ``true`` if contents of both arrays are the same, i.e. they have all equal bytes at the corresponding indices.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PackedByteArray_operator_idx_int:
- .. rst-class:: classref-operator
- :ref:`int<class_int>` **operator []** **(** :ref:`int<class_int>` index **)**
- Returns the byte at index ``index``. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error.
- Note that the byte is returned as a 64-bit :ref:`int<class_int>`.
- .. |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.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|