Instances of RandomAccessFile support both reading and writing to a random access file.
A random access file behaves like a large array of bytes stored in the file system. There is a kind of cursor, or index into the implied array, called the file pointer; input operations read bytes starting at the file pointer and advance the file pointer past the bytes read. If the random access file is created in read/write mode, then output operations are also available; output operations write bytes starting at the file pointer and advance the file pointer past the bytes written. Output operations that write past the current end of the implied array cause the array to be extended. The file pointer can be read by the getFilePointer method and set by the seek method.
Benefits of Using Random Access File
Unlike IO streams that allow reading and writing data sequentially, random access file allows you to read and write a small chunk of data at any position in the file, using a file pointer. By controlling this file pointer, you can move forth and back within the file to perform reading and writing operations, at any position you want, in a random fashion.
Random access file is ideal for manipulating a particular file format at low level, such as reading, creating and updating MP3 files, PDF files, etc.
Constructors

Access Modes

Few Important Methods

Note: For reading and writing, as the RandomAccessFile class implements both the DataOutput and DataInput interfaces, you can use some of the below methods.
Reading methods: read(byte[]), readByte(), readInt(), readLong(), etc.
Writing methods: write(byte[]), writeByte(), writeInt(), writeLong(), etc.
Please visit RandomAccessFile Documentation for the entire list of methods.