Title: RandomAccessFile class
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER > Section: Learning Units - Bb

Presentations and Videos

- RandomAccessFile class lecture video (Time: 26:00)
- RandomAccessFile class document

- Most Java Input/Output files tend to do either input or output in a sequential manner. The RandomAccessFile class allows you to open a file for both input and output at the same time. The RandomAccessFile class also provides binary options as well as the ability to move randomly around in the file using a "seek" method.
- Many of the methods of RandomAccessFile remind us of ObjectInputStream and ObjectOutputStream. However, the additional methods seek, and getFilePointer are useful to move around within the file in a non-sequential fashion.
- An example (RandomPeople.java) is worked to demonstrate the usefulness of RandomAccessFile. This example is patterned on some work that once read and wrote PDF files.