ByteUtils class
字节工具类(全静态)。
所有窗口操作(extract / combine / insert / remove)均返回新数组, 不修改入参;越界的 index / length 一律钳制到有效范围而非抛错。
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
clone(
Uint8List bytes) → Uint8List - 深拷贝字节数组。
-
combine(
{required Uint8List a, required Uint8List b}) → Uint8List - 拼接两个字节数组(返回新数组,不修改入参)。
-
extract(
{required Uint8List origin, required int indexStart, required int length}) → Uint8List -
从
origin的indexStart起截取length字节。 -
fromBase64(
String encoded) → Uint8List -
base64 字符串 → 字节数组(非法输入由
dart:convert抛 FormatException)。 -
fromReadable(
String readable, {Radix radix = Radix.hex}) → Uint8List - 可读字符串 → 字节数组。
-
insert(
{required Uint8List origin, required int indexStart, required Uint8List arrayInsert}) → Uint8List -
在
origin的indexStart处插入arrayInsert。 -
remove(
{required Uint8List origin, required int indexStart, required int lengthRemove}) → Uint8List -
从
origin的indexStart起删除lengthRemove字节。 -
same(
Uint8List a, Uint8List b) → bool - 判断两个字节数组长度与逐字节内容是否一致。
-
toBase64(
Uint8List bytes) → String - 字节数组 → base64 字符串。
-
toReadable(
Uint8List bytes, {Radix radix = Radix.hex, String separator = ' '}) → String - 字节数组 → 可读字符串。