I've developed function which allows to skip to a desired line number within a text file (see function).
However, what I would like to do is develop a function which takes me to the beginning of the file (i.e. line 0) after calling the navigateForwardToLine function.
However, I can't seem to work out how to do this.
Would anyone have any suggestions on how do this.
Thanks in advance for your help.
/************************************************************************/
...
...
reader = new InputStreamReader(new FileInputStream(this.fileName));
lnr = new LineNumberReader(reader);
private void navigateForwardToLine(int lineNum)
{
int currentLine = lnr.getLineNumber();
try
{
for( int intCurrentLine = currentLine; intCurrentLine < lineNum; intCurrentLine++)
{
lnr.readLine();
}
}
catch(IOException e)
{
e.System.out.println(e.getMessage());
}
}
/************************************************************************/