The RandomAccessFile Class

The RandomAccessFile class provides the capability to perform I/O directly to specific locations within a file. The name random access comes from the fact that data can be read from or written to random locations within a file rather than as a continuous stream of information. Random access is supported through the seek() method, which allows the pointer that corresponds to the current file position to be set to arbitrary locations within the file.

RandomAccessFile implements both the DataInput and DataOuput interfaces. This provides the capability to perform I/O using primitive data types.

RandomAccessFile also supports basic file read/write permissions, enabling files to be accessed in read-only or read-write modes. ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.