http://www.verejava.com/?id=1699464804818
package com.io; import java.io.*; public class TestOutputStream { public static void main(String[] args) { OutputStream os=null; try { os=new FileOutputStream(new File("res/test.txt")); //向文件中写入数据 String content="good morning"; byte[] data=content.getBytes(); os.write(data); } catch (Exception e) { e.printStackTrace(); } finally { try { os.close();//关闭输出流 } catch (IOException e) { e.printStackTrace(); } } } }
http://www.verejava.com/?id=1699464804818