我有一个FileOutputStream 类类型的对象,现在我想将他保存到本地硬盘。
用什么方法写啊
那位指导一下

解决方案 »

  1.   

    你到底要保存什么
    是把一个File用Stream写到硬盘上去
    还是需要保存这个FileOutStream对象保存文件的,上GOOGLE搜索一下...太多了,就不说了如果要保存FileOutStream对象,你需要在实现类里调用Serializable接口来实现序列化
      

  2.   

    java.io.FileOutputStream好像没实现Serializable接口吧除非你extends后实现不过从设计的角度,流这种东西序列化很奇怪
      

  3.   

    try {
    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("c:\\test.txt"));
    bos.flush();
    bos.close();
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }