把字节数组保存为一个文件
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;
}
* 把字节数组保存为一个文件
* @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;
}
相关文章推荐
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byt
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- 作业二:将字符串数组把重复数据剔除后写入一个文件保存起来。
- java 文件上传 与 把文件解析成一个字节数组简单的后台示例
- unserialize的这个问题是由一个emlog论坛用户在使用时报错而发现的 问题表现情况如下: emlog缓存的保存方式是将php的数据对象(数组)序列化(serialize)后以文件的形式存放,
- 字节数组保存为文件
- 字节数组用txt文件保存工具类
- 处理2D图像和纹理——创建一张纹理,定义每个像素的颜色,将纹理保存到一个文件
- Android中根据byte数组生成文件并保存到手机
- 一个在B/S中弹出保存文件对话框的程序
- 一个数组中有30个数(随机产生[0,30]),将数组中重复的数字去除,动态创建数组保存剩下的数字
- php解析xml文件到一个数组
- 自己写的一个利用h5py保存hdf文件的例子,留存!
- 作业: 1.创建一个窗口程序(JFrame),标题栏起名为“浏览器”,有一个菜单条,有“文件”、“编辑”、“查看”3个菜单。“文件”菜单有两个菜单项,一项是“打开”,一项是“保存”,“打开”项做成子菜
- android Bitmap如何保存成为一个bmp 文件
- PHP 生成js 数组 和保存为JS文件