/** * Fetch the entire contents of a text file, and return it in a String. * This style of implementation does not throw Exceptions to the caller. * * @param aFile is a file which already exists and can be read. */ static public String getContents(File aFile) { //...checks on aFile are elidedStringBuffer contents = new StringBuffer();

//declared here only to make visible to finally clauseBufferedReader input = null; try { //use buffering //this implementation reads one line at a time input = new BufferedReader( new FileReader(aFile) ); String line = null; //not declared within while loop while (( line = input.readLine()) != null){ contents.append(line);