hi,
I am trying to read a file twice. The sample code is as follows:
Code:BufferredReader fileReader = new BufferedReader(new FileReader("abc.txt"));
if(CiscoTraceRouteParser.canParse(fileReader))
{
// Do Something
}
else if(JuniperTraceRouteParser.canParse(fileReader))
{
// Do something else
}
The canParse methods are of the type
The problem is if the first 'if' check fails, then we have to do the second if check which when has to readLine from the first line of the same file. This is failing. I tried to mark and then do a reset , but not able to get the pointer reset to the begining of the file second time around.Code:public static boolean canParse(BufferredReader fileReader)
{
while((line == fileReader.readLine()) != null)
{
if(some condition satisfied for the line)
return true;
}
return false;
}
Please help me out with this. Thansk!
Pradeep

