fun saveStreamToFile(srcArray: ByteArray, destStr: String) { val fis=ByteArrayInputStream(srcArray) val fos: OutputStream=FileOutputStream(destStr) try { val buffer = ByteArray(1024) var length: Int while (fis.read(buffer).also { length = it } !=-1) { fos.write(buffer, 0, length) } } finally { fis.close() fos.close() } }
安卓开发中字节流(内存数据)保存到文件的快速方法(kotlin语言)
最新推荐文章于 2024-03-31 13:59:15 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)