import java.io.*;
public class AppendContent
{
    public static void main(String[] args)
    {
        try(RandomAccessFile raf = new RandomAccessFile("out2.txt", "rw"))
        {
            raf.seek(raf.length());
            raf.write("追加的内容! \r\n".getBytes());
        }
        catch (IOException ex)
        {
            ex.printStackTrace();
        }
    }
}

将看到out2.txt文件中:追加的内容! 

posted on 2013-05-29 18:38  bailun  阅读(196)  评论(0编辑  收藏  举报