您的位置:首页 > 其它

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

2011-11-24 17:38 183 查看
/**

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

* @EditTime 2007-8-13 上午11:45:56

*/

public static File getFileFromBytes(byte[] b, String outputFile) {

BufferedOutputStream stream = null;

File file = null;

try {

file = new File(outputFile);

FileOutputStream fstream = new FileOutputStream(file);

stream = new BufferedOutputStream(fstream);

stream.write(b);

} catch (Exception e) {

e.printStackTrace();

} finally {

if (stream != null) {

try {

stream.close();

} catch (IOException e1) {

e1.printStackTrace();

}

}

}

return file;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐