C H A P T E R  7

Image

Random Access Files

In previous chapters we have explored files sequentially. Files that can be explored sequentially are known as sequential files. In this chapter you will see the advantages of using nonsequential (random) access to a file’s contents. Files that permit random access to their contents are known as random access files (RAFs). Sequential files are used more often because they are easy to create, but RAFs are more flexible and their data can be located faster.

With a RAF, you can open the file, seek a particular location, and read from or write to that file. After you open a RAF, you can read from it or write ...

Get Pro Java 7 NIO.2 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.