Basic HTML version of Foils prepared 17 Nov 97

Foil 35 Random Access

From Java Tutorial, July 1, 1996 CEWES Tutorial, CPS606, JSU Class CSC499 -- July 22-25 1997, Fall 97. by Nancy J. McCracken,Geoffrey C. Fox, Tom Scavo

Random Access Files for Foil 35
1 The RandomAccessFile class offers all the functionality of DataInputStream and DataOutputStream combined, plus additional capabilities.
2 To open a random access file for reading, use:
3 RandomAccessFile in =
  • new RandomAccessFile( filename, "r" );
4 Such a file may be accessed sequentially with
5 in.readLine();
6 or randomly by repositioning the file pointer:
7 in.seek( offset );
8 where offset is a byte offset into the random file. (Use "rw" for read/write access.)
9 Random access files have no inherent structure; the structure must be imposed by the programmer.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998