hi!
I am trying to read file line by line using BufferReader class.Following I have written to read but some how for few of the file it is not reading the whole file. Can any help me to resolve this or suggest me the best apporch to read line by line from given file ?
try {
br = FileRead.readTOLine(path ,filename);
while ((line =br.readLine()) != null){
line = line.toUpperCase().trim();
ltrim(line);
rtrim(line);
System.out.println(line);
System.out.flush();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
public class FileRead {
/* Pass filename and path as input
* Return BufferedReader
*/
public static BufferedReader readTOLine(String path, String filename) throws IOException{
BufferedReader br= new BufferedReader (new FileReader (path + filename));
//br.close();
return br;
}
/*
* Pass Reader as input
* Return String
* */