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

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
    关注
    评论

报告相同问题?