RKGG爱吃鱼 2017-11-06 03:22 采纳率: 50%
浏览 1636

java 将一个byte[]数组转成二进制文件丢失数据是为什么啊?

File sdpath = Environment.getExternalStorageDirectory();
String path = sdpath.getPath() + "/模型文件/";
File file = new File(path + strPath);
OutputStream os;
FileOutputStream fos;
try {
os = new FileOutputStream(file);
BufferedInputStream is = new BufferedInputStream(new ByteArrayInputStream(bs));
int len;
byte[] buf = new byte[1024 * 8];
while ((len = is.read(buf)) != -1) {
os.write(buf, 0, len);
os.flush();
}
is.close();
os.close();


  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-06 03:23
    关注
    评论

报告相同问题?

悬赏问题

  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误