I have some code like this:
FileReader fr = new FileReader(file);
BufferedReader reader = new BufferedReader(fr);
for (int i=0;i<100;i++)
{
String line = reader.readLine();
...
}
FileReader fr = new FileReader(file);
fr.skip(position);
BufferedReader reader = new BufferedReader(fr);
for (int i=0;i<100;i++)
{
String line = reader.readLine();
...
}
I can not figure out how to get / calculate the value for 'position'.
Two things: I donβt have an explicit file with a fixed length (i.e., each line has a different length) I need to get it to work on any system (linux, unix, windows), so I'm not sure if I can read the length of a new line (be it one or two characters)
Any help is greatly appreciated.
Thank,
source
share