"Hyden Zeng" <> wrote in message
news: om...
| Hi all,
| got one question regarding file reading.
| How do I directly access a certain byte
RandomAcessFile
|..or line of a file using Java?
If it's FCW, use the formula ((LineNo-1)*LineWidth)
to calculate which byte the line corresponds to,
then RAF.
Otherwise, the best you could do on a non-FCW
file is a binary search, unless you are prepared to
trawl throught he file once, and creat a second
(much smaller) FCW 'index file' for the larger file.
| ..the time complexity should be O(1).
In a perfect world, yes. (I am just guessing
what O(1) means)
| Thank you.
You're welcome..
--
Andrew Thompson
*
http://www.PhySci.org/ PhySci software suite
*
http://www.1point1C.org/ 1.1C - Superluminal!
*
http://www.AThompson.info/andrew/ personal site