首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

把字节数组保存为一个资料

2012-10-30 
把字节数组保存为一个文件/** * 把字节数组保存为一个文件 ** @param b * @param outputFile * @return */

把字节数组保存为一个文件

/** * 把字节数组保存为一个文件 *  * @param b * @param outputFile * @return */public static File getFileFromBytes(byte[] b, String outputFile) {File ret = null;BufferedOutputStream stream = null;try {ret = new File(outputFile);FileOutputStream fstream = new FileOutputStream(ret);stream = new BufferedOutputStream(fstream);stream.write(b);} catch (Exception e) {log.error("helper:get file from byte process error!");e.printStackTrace();} finally {if (stream != null) {try {stream.close();} catch (IOException e) {log.error("helper:get file from byte process error!");e.printStackTrace();}}}return ret;}

?

热点排行