RawArray

Category: Built-In Types

Brief Description

Raw byte array.

Member Functions

RawArray RawArray ( Array from )
String get_string_from_ascii ( )
String get_string_from_utf8 ( )
void push_back ( int byte )
void resize ( int idx )
void set ( int idx, int byte )
int size ( )

Description

Raw byte array. Contains bytes. Optimized for memory usage, can’t fragment the memory.

Member Function Description

Create from a generic array.

  • 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.

  • void push_back ( int byte )

Append an element at the end of the array.

  • void resize ( int idx )

Set the size of the RawArray. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.

  • void set ( int idx, int byte )

Change the byte at the given index.

Return the size of the array.