Skip to content

Instantly share code, notes, and snippets.

@clarenced
Created August 11, 2011 14:57
Show Gist options
  • Save clarenced/1139881 to your computer and use it in GitHub Desktop.
Save clarenced/1139881 to your computer and use it in GitHub Desktop.
public static void readFile(String path) {
BufferedReader buffer = null;
try {
buffer = new BufferedReader(new FileReader(path));
String line;
while( (line = buffer.readLine()) != null){
System.out.println(line);
}
} catch (FileNotFoundException fne) {
System.out.println("File Not found");
} catch(IOException ioe){
System.out.println("Read error");
} finally {
try {
if(buffer != null)
buffer.close();
} catch(IOException ioe){
System.out.println("Buffer error");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment