Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to access of record randomly  RSS feed

 
rudra tripathy
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

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.

cheers
k
[ July 05, 2004: Message edited by: karl koch ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!