
Here's a brief desc of what my Java code does .. I'm using BufferedReader to read lines from a text files and split each line based on a predefined size... Eg : If the 1st line of the text file is as follows ABC12345DEF3 and i need to split it based on a size like 3,5,2,2(which i'm reading from an excelsheet) Then my output is as follows ABC 12345 DE F3 I need to do this for a file with 11 lines. Here's my code
while((line = br.readLine())!= null)
{
int lineLength = line.length();
for(int k = 0;k < lineLength;k++)
{
oldArrayVal = arr[k] + oldArrayVal;
tokens[k] = line.substring(flag, oldArrayVal);
System.out.println(tokens[k]);
sizeOfToken = tokens[k].length();
flag = oldArrayVal;
}
}
br.close();
And here's the problem I'm facing. Only the first line is being read from the text file and displays the output as desired. Unable to read the rest of the lines within the text files. Any help would be appreciated...
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.