- Timestamp:
- 2016-08-12T19:47:27+12:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r29972 r30701 74 74 static final public String PERL_EXECUTABLE_WINDOWS = "Perl.exe"; 75 75 76 77 /** 78 * Reads in a text file and returns the contents as a String 79 */ 80 static public String readFile(File file) { 81 BufferedReader fin = null; 82 StringBuffer contents = new StringBuffer(); 83 84 try { 85 fin = new BufferedReader(new FileReader(file)); 86 String line = null; 87 while((line = fin.readLine()) != null) { 88 contents.append(line); 89 contents.append("\n"); 90 } 91 } catch(IOException e) { 92 System.err.println("*** Could not read in file: " + file.toString()); 93 System.err.println("*** Exception occurred: " + e.getMessage()); 94 } finally { 95 try { 96 if(fin != null) { 97 fin.close(); 98 fin = null; 99 } 100 } catch(IOException ioe) { 101 fin = null; 102 103 } 104 } 105 106 return contents.toString(); 107 } 76 108 77 109 /**
Note:
See TracChangeset
for help on using the changeset viewer.