File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes how to access of record randomly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to access of record randomly" Watch "how to access of record randomly" New topic

how to access of record randomly

rudra tripathy

Joined: May 26, 2004
Posts: 25
i have got a files with predefined format.
i want to access each record randomly.
each record is a line.
pls help me
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388

how many records are in your file ?
if there is only a small number of records, then you can read it into an array (String[] or MyRecord[])or List manipulate it and then write it back to disk. or you can just acccess the file, skip all the lines you dont need...

also check the RandomAccessFile API and
google random access file or consider a real database.

[ July 05, 2004: Message edited by: karl koch ]
It is sorta covered in the JavaRanch Style Guide.
subject: how to access of record randomly
It's not a secret anymore!