Использование randomaccessfile () в Java
// Create a random access file object.
RandomAccessFile file = new RandomAccessFile("myfile.dat", "rw");
// Writing to the file.
file.writeChar('S');
// Moving file pointer to the beginning.
file.seek(0);
// Reading data from the file.
System.out.println(file.readChar());
Owais Ansar Ansar Munir