将String保存成文件
来源:互联网 发布:消防联动编程 编辑:程序博客网 时间:2024/05/27 20:58
如题,将String保存成文件。
/** * 将String数据存为文件 */ public static File getFileFromBytes(String name,String path) { byte[] b=name.getBytes(); BufferedOutputStream stream = null; File file = null; try { file = new File(path); 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; }
byte数据保存为文件:
/** * 将byte数据存为文件 */ public static File getFileFromBytes(byte[] b,String path) { BufferedOutputStream stream = null; File file = null; try { file = new File(path); 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; }
- 将String保存成文件
- 将String保存成文件
- (写文件)将字符串保存成文件
- 将文件流转换成String,然后将转换后的String再转换成文件流
- c/vc/c++ 将mysql二进制字段(longblob类型)读出来保存成文件
- js将来页面保存成文件
- SecureCRT怎么导出保存成文件
- android将字串转换成文件存储
- android将Bitmap转换成文件
- python将汉字保存成文本
- 用java实现print screen,读取位图文件,将位图文件转化位jpeg格式并保存成文件输出!
- Wireshark抓包保存文件(图片,视频,音频等)----可以将传输的数据直接存成文件
- 提取WORD中的所有InlineShape图片并保存成文件
- 在RTF格式中提取图片并保存成文件
- 关于Matlab中把figure保存成文件
- 怎样把文件夹中文件名保存成文件?
- 用OpenCV随机显示 一个圆圈,并保存成文件
- matlab的数据如何保存成文件被VS调用
- poj1656
- 测试工程师职业要求汇总
- OpenGL
- 看其他人是怎么安排读书时间的
- 03_Activity 生命周期介绍【图解】
- 将String保存成文件
- SSH简介
- j2se小节
- CSS pitfalls and how to overcome them
- VS2010/2008 C++ program error:output window disappears 运行窗口自动退出
- “display:block-inline形式的Span或Div中添加文字后,导致Span或Div排版掉落、错位”的原因及解决方法
- 字符串的倒序输出
- ubuntu eclipse安装
- NAND Flash的驱动程序设计