Java Reference
In-Depth Information
Note Operations on a random access file opened in "rwd" or "rws" mode are
slower than these same operations on a random access file opened in "rw" mode.
Theseconstructorsthrow FileNotFoundException when mode is "r" andthe
fileidentifiedby pathname cannotbeopened(itmightnotexistoritmightbeadir-
ectory), or when mode is "rw" and pathname is read-only or a directory.
existing random access file via the "r" mode string:
RandomAccessFile raf = new RandomAccessFile("employee.dat",
Arandomaccessfileisassociatedwitha file pointer ,acursorthatidentifiestheloca-
set to its first byte, at offset 0. The file pointer is also set to 0 when the file is created.
Write and read operations start at the file pointer and advance it past the number of
to be extended. These operations continue until the file is closed.
RandomAccessFile declaresawidevarietyofmethods.Ipresentarepresentative
sample of these methods in Table 8-6 .
Search WWH ::

Custom Search