you can judge the file whether or not empty
if the file is empty,you add the new data.
if the file is not empty,you move the pointer to the end of file,and then add the new data after old data.
sorry,my english speeking is so weak.(-_-)!

解决方案 »

  1.   

    use RandomAccessFile class,
    import java.io.*;
    ... try{
    File file = new File("D:/test/Test.java");
    String appendStr = "Append in the end";
    RandomAccessFile ras= new RandomAccessFile(file,"rw");
    long length = file.length ();
    ras.seek ((int)length);
    ras.write (appendStr.getBytes ());
             }catch(IOException ex){
    ex.printStackTrace ();
    }finally{
                 try{
                 ras.close();
               }catch(Exception ex){}
             }
      

  2.   

    thank u guys, that really helps a lot.......^.^
      

  3.   

    文件追加 FileOutputStream writefile=new FileOutputStream ("write_in_here.txt",true);