PoolByteArray¶
类别: 内置类型
方法¶
PoolByteArray ( Array from ) |
|
无效 |
|
无效 |
append_array ( PoolByteArray array ) |
decompress ( int buffer_size, int compression_mode=0 ) |
|
无效 |
invert ( ) |
无效 |
|
无效 |
|
无效 |
|
无效 |
|
sha256_string ( ) |
|
size ( ) |
|
方法说明¶
PoolByteArray PoolByteArray ( Array from )
构建新的 PoolByteArray
. 或者,可以传入一个泛型 Array 这将被转换。
void append ( int byte )
在数组末尾附加一个元素(数组的别名 push_back )
void append_array ( PoolByteArray array )
附录A PoolByteArray
在这个数组的末尾。
PoolByteArray compress ( int compression_mode=0 )
返回新的 PoolByteArray
数据被压缩。使用以下选项之一设置压缩模式 CompressionMode 的常量。
PoolByteArray decompress ( int buffer_size, int compression_mode=0 )
返回新的 PoolByteArray
将数据解压缩。集合 buffer_size
到未压缩数据的大小。使用以下选项之一设置压缩模式 CompressionMode 的常量。
String get_string_from_ascii ( )
将数组内容的副本返回为 String . 快速替代 get_string_from_utf8 如果内容仅为ASCII。与utf-8函数不同,此函数将每个字节映射到数组中的一个字符。多字节序列将无法正确解释。对于分析用户输入,始终使用 get_string_from_utf8 .
String get_string_from_utf8 ( )
将数组内容的副本返回为 String . 比…慢 get_string_from_ascii 但支持UTF-8编码数据。如果您不确定数据源,请使用此函数。对于用户输入,应始终首选此功能。
在数组的给定位置插入新元素。位置必须有效,或在数组末尾 (idx == size()
)
void invert ( )
反转数组中元素的顺序。
void push_back ( int byte )
在数组末尾附加元素。
void remove ( int idx )
按索引从数组中删除元素。
void resize ( int idx )
设置数组的大小。如果数组增大,则在数组末尾保留元素。如果数组收缩,则将数组截断为新的大小。
更改给定索引处的字节。
String sha256_string ( )
返回poolbytearray的sha-256字符串。
int size ( )
返回数组的大小。
PoolByteArray subarray ( int from, int to )
返回 PoolByteArray
作为新的 PoolByteArray
. 任何负索引都被认为是从数组的末尾开始的。