i am using RandomAccessFile in a Java program on Linux that deals with a huge amount of data.
so what i am doing is i keep many files, each file contains different information.
when i preform the action
int x=???//some large number
RandomAccessFile rand = new RandomAccessFile("file.txt","r");
rand.seek(x); //the file contains more than x bytes
byte b = rand.readByte();
what is the complexity of the program?
does the program preform 2 actions in the last 2 lines?
one for seeking to the xth byte and one for reading the byte? – in other words the whole file is in one consecutive location on the disk(like an array)?
or does it preform x actions for the seek and one for the reading?
thank you
Matt
Seek just positions the internal pointer, it doesn’t read anything from the disk.