Ignore:
Timestamp:
2016-08-12T19:47:27+12:00 (8 years ago)
Author:
ak19
Message:

All the changes to get the new collectionConfig.xml Editor (ConfigFileEditor.java) to work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r29972 r30701  
    7474    static final public String PERL_EXECUTABLE_WINDOWS = "Perl.exe";
    7575
     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    }
    76108
    77109    /**
Note: See TracChangeset for help on using the changeset viewer.