PoolByteArray¶
Category: Built-In Types
Brief Description¶
Raw byte array.
Member Functions¶
PoolByteArray | PoolByteArray ( Array from ) |
void | append ( int byte ) |
void | append_array ( PoolByteArray array ) |
PoolByteArray | compress ( int compression_mode=0 ) |
PoolByteArray | decompress ( int buffer_size, int compression_mode=0 ) |
String | get_string_from_ascii ( ) |
String | get_string_from_utf8 ( ) |
int | insert ( int idx, int byte ) |
void | invert ( ) |
void | push_back ( int byte ) |
void | remove ( int idx ) |
void | resize ( int idx ) |
void | set ( int idx, int byte ) |
int | size ( ) |
PoolByteArray | subarray ( int from, int to ) |
Description¶
Raw byte array. Contains bytes. Optimized for memory usage, can’t fragment the memory.
Member Function Description¶
- PoolByteArray PoolByteArray ( Array from )
Create from a generic array.
- void append ( int byte )
- void append_array ( PoolByteArray array )
Append an PoolByteArray at the end of this array.
- PoolByteArray compress ( int compression_mode=0 )
Returns a new PoolByteArray with the data compressed. The compression mode can be set using one of the COMPRESS_* constants of File.
- PoolByteArray decompress ( int buffer_size, int compression_mode=0 )
Returns a new 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 File.
- 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).
- 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.
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()).
- void invert ( )
Reverse the order of the elements in the array (so first element will now be the last).
- void push_back ( int byte )
Append an element at the end of the array.
- void remove ( int idx )
Remove an element from the array by index.
- void resize ( int idx )
Set the size of the PoolByteArray. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
Change the byte at the given index.
- int size ( )
Return the size of the array.
- PoolByteArray subarray ( int from, 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.