把字符串写下本地文件保存 java 源码

把字符串写入本地文件保存 java 源码
public  void FileOutputStream(String str) throws Exception{

//         File txt=new File("D:\\Documents and Settings\\bizOrdeId.txt");
// if(!txt.exists()){
// txt.createNewFile();
// }
// byte bytes[]=new byte[512];
// bytes=str.getBytes();   //
// int b=str.length();   //改
// FileOutputStream fos=new FileOutputStream(txt);
// fos.write(bytes,0,b);
// fos.close();


    String path="D://Documents and Settings//bizOrdeId.txt";  
    try {  
         FileWriter fw=new FileWriter(path,true);  
         BufferedWriter bw=new BufferedWriter(fw);  
         bw.newLine();  
         bw.write(str);  
         bw.close(); 
         fw.close();  
  } catch (IOException e) {  
       // TODO Auto-generated catch block  
      e.printStackTrace();  
   }
}