|
@@ -1,6 +1,6 @@
|
|
|
import promptAction from '@ohos.promptAction';
|
|
|
import { BusinessError, deviceInfo } from '@kit.BasicServicesKit';
|
|
|
-import { HashMap, util } from '@kit.ArkTS';
|
|
|
+import { buffer, HashMap, util } from '@kit.ArkTS';
|
|
|
import { DeviceInfo } from '../bean/DeviceInfo';
|
|
|
import { common } from '@kit.AbilityKit';
|
|
|
import { md5_hex } from '../util/md5';
|
|
@@ -433,6 +433,11 @@ export class ToolsHelper {
|
|
|
return decoder.decodeToString(new Uint8Array(arrayBuffer))
|
|
|
}
|
|
|
|
|
|
+ static stringToArrayBuffer(str: string): ArrayBuffer {
|
|
|
+ let buf = buffer.from(str, 'utf-8'); // 使用 UTF-8 编码
|
|
|
+ return buf.buffer;
|
|
|
+ }
|
|
|
+
|
|
|
private static setTimeOutMap: Map<string, ThrottleInterface> = new Map()
|
|
|
private static uniqueIdMap = new WeakMap<Function, string>();
|
|
|
|