RandomAccessFile
is for a random-access file.
It is not derived from InputStream or OutputStream.
It implements the interfaces DataInput and DataOutput.
It also implements the AutoCloseable and Closeable interfaces.
RandomAccessFile supports positioning requests, we can position the file pointer within the file.
It has these two constructors:
RandomAccessFile(File fileObj , String access) throws FileNotFoundException RandomAccessFile(String filename , String access) throws FileNotFoundException
The method seek()
can set the current position of the file pointer within the file:
void seek(long newPos) throws IOException