代码如下:
public static void saveBytesToFile(String filePath, byte[] data) {
File file = new File(filePath);
BufferedOutputStream outStream = null;
try {
outStream = new BufferedOutputStream(new FileOutputStream(file));
outStream.write(data);
outStream.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != outStream) {
try {
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
如果对您有用的话赞一下呗!谢谢谢谢~