[19] Using a Random Access File

[19] Using a Random Access File

    try {
        File f = new File("filename");
        RandomAccessFile raf = new RandomAccessFile(f, "rw");
   
        // Read a character
        char ch = raf.readChar();
   
        // Seek to end of file
        raf.seek(f.length());
   
        // Append to the end
        raf.writeChars("aString");
        raf.close();
    } catch (IOException e) {
    }



|----------------------------------------------------------------------------------------|
                           版权声明  版权所有 @zhyiwww
            引用请注明来源 http://www.blogjava.net/zhyiwww   
|----------------------------------------------------------------------------------------|

你可能感兴趣的:([19] Using a Random Access File)