While still incredibly useful, sequential access files are a consequence of sequential medium such as magnetic tape. Random access files, on the other hand, permit non-sequential, or random, access to the contents of a file. Random access files are useful for many different applications. One specific example of a good use of random access files are zip files.
Zip files contain other files and are compressed to conserve space.
With a random access file, you only read the direntry and the file that you need. The RandomAccessFile class in the java.io package implements a random access file. Unlike the input and output streams in java.io, RandomAccessFile is used for both reading and writing files. You create the RandomAccessFile with different arguments depending on whether you intend to read or write. This has some disadvantages in that you can't apply the same filters to RandomAccessFiles that you can to streams.