首页 > 代码库 > Java RandomAccessFile 文件写入

Java RandomAccessFile 文件写入

            public void mouseDown(MouseEvent e) {
                try{
                    //指定目标文件
                RandomAccessFile F = new RandomAccessFile("F:\\test.txt","rw");
                
//检索文件长度
long filelength = F.length(); // String content = text.getText(); //指针指向最后一位 F.seek(filelength); F.writeBytes(text.getText()+"\n"+text_1.getText() + "\n"+ btnCheckButton.getVisible()); F.close(); JOptionPane.showMessageDialog(null, "writein complet"); }catch (IOException S){ S.printStackTrace(); }