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
字节数组 → 可读字符串。