Wednesday, January 28, 2009

Going through a file line by line in java

BufferedReader inFile = new BufferedReader("filename");
String line = null;
try {
   while ((line=inFile.readLine())!=null) {
      //do something with the line here
   }
}
catch (IOException ioe) {
   ioe.printStackTrace();
}

No comments:

Post a Comment