let s = String.fromCodePoint.apply(null, new Uint8Array(buf));
console.log("readFile=============s==" + s);
let d = decodeURIComponent(escape(s));
console.log("readFile=============d==" + d);
// 关闭文件流
inputStream.closeSync();
}
复制代码
在执行问写入,再执行读取的时候,调用readFile方法,在执行到该方法let s = String.fromCodePoint.apply(null, new Uint8Array(buf)); s得到的不绝是"",没有内容
文件读写可参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/app-file-access-management-V5
2、HarmonyOS 获取和设置屏幕亮度方法?
04-19 18:15:58.074 1611 5120 E C01401/Bufferqueue: [nodict]<514>CheckBufferConfig: width or height is greater than 0, now is w 0 h 0
04-19 18:15:58.074 1611 5120 E C01401/Bufferqueue: [nodict](HEncoderSurface) AllocBuffer: Failure [1669], Reason: Alloc failed, then <400 invalid arguments>
04-19 18:15:58.074 1611 5120 E C01401/Bufferqueue: [nodict](HEncoderSurface) RequestBuffer: Fail to alloc or map Buffer[0 0] ret: 40001000, id: 6919192313868
04-19 18:15:58.074 19365 19554 E C01401/Bufferqueue: [nodict]<115>NativeWindowRequestBuffer: API failed, please check RequestBuffer function ret:40001000, Queue Id:6919192313868
04-19 18:15:58.074 19365 19554 E A0FF00/Xhey:C:EglRenderContext: EglRenderContext::SwapBuffers: Failed to SwapBuffers on EGLSurface 1, error is EGL_SUCCESS.