R
ruds
Hello,
I'm reading a file which is sbout 3.5 GB in size. And extracting some
fields from the file.
For smaller file the program works fine but for this file , it is not
reaching the end of file and exits.
How should I force the program to reach end of file?
To read the file I'm using:
while((str=br.readLine())!=null)
{
//set of operations
}
My sample code is:
public void getLine(String file) throws IOException
{
fr=new FileReader(file);
br=new BufferedReader(fr);
no=0;
i=0;
j=0;
while((str=br.readLine())!=null)
{
no++;
if(str.startsWith("$SUBCASE"))
{
st1= new StringTokenizer(str," ");
while(st1.hasMoreTokens())
{
tok1=st1.nextToken();
if(tok1.equals("="))
{
tok2=st1.nextToken();
if(tok2.equals(id))
continue;
else
{
id=tok2;
subcase[j]=Integer.parseInt(id);
line=no-5;
System.out.println("Subcase="+subcase[j]);
i++;
j++;
}
}
}
}
else
continue;
}
System.out.println("end of getLine");
fr.close();
}
Please help ! Its urgent.
I'm reading a file which is sbout 3.5 GB in size. And extracting some
fields from the file.
For smaller file the program works fine but for this file , it is not
reaching the end of file and exits.
How should I force the program to reach end of file?
To read the file I'm using:
while((str=br.readLine())!=null)
{
//set of operations
}
My sample code is:
public void getLine(String file) throws IOException
{
fr=new FileReader(file);
br=new BufferedReader(fr);
no=0;
i=0;
j=0;
while((str=br.readLine())!=null)
{
no++;
if(str.startsWith("$SUBCASE"))
{
st1= new StringTokenizer(str," ");
while(st1.hasMoreTokens())
{
tok1=st1.nextToken();
if(tok1.equals("="))
{
tok2=st1.nextToken();
if(tok2.equals(id))
continue;
else
{
id=tok2;
subcase[j]=Integer.parseInt(id);
line=no-5;
System.out.println("Subcase="+subcase[j]);
i++;
j++;
}
}
}
}
else
continue;
}
System.out.println("end of getLine");
fr.close();
}
Please help ! Its urgent.