public void save2File(String filePath, byte[] data) {
BufferedOutputStream bufferOutput = null;
try {
bufferOutput = new BufferedOutputStream(new FileOutputStream(
new File(filePath)), 1024);
bufferOutput.write(data);
bufferOutput.flush();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (bufferOutput != null) {
try {
bufferOutput.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
转载于:https://my.oschina.net/forrest420/blog/110272