加载中…
个人资料
喜欢就告诉她
喜欢就告诉她
  • 博客等级:
  • 博客积分:0
  • 博客访问:0
  • 关注人气:0
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

File流写数据

(2013-01-20 10:06:40)
标签:

file

文件流

杂谈

File.separator--------------------"/"

private void saveFile(File from, String path, String fileName){
            try {
                    System.out.println("文件输出中...");
                    FileInputStream in = new FileInputStream(from);
                    OutputStream out = new FileOutputStream(path + File.separator + fileName);
                    int b = 0;
                    while ((b = in.read()) != -1) {
                        out.write(b);
                    }
                    out.flush();
                    out.close();
                    in.close();
                    System.out.println("文件写入完毕!");
            }catch (Exception e) {
                e.printStackTrace();
            }
        }

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有