public static String readDefinitionsFile(String file) throws IOException {
  BufferedReader br=new BufferedReader(new FileReader(file));
  try {
    StringBuilder builder=new StringBuilder();
    String line=null;
    String newLine=System.getProperty("line.separator");
    while ((line=br.readLine()) != null) {
      builder.append(line);
      builder.append(newLine);
    }
    return builder.toString();
  }
  finally {
    try {
      if (br != null)       br.close();
    }
 catch (    IOException ex) {
      logger.warn("Unable to close file " + file + ": "+ ex.toString());
    }
  }
}

public static String readDefinitionsFile ( String file ) throws IOException { BufferedReader br = new BufferedReader ( new FileReader ( file ) ) ; try { StringBuilder builder = new StringBuilder ( ) ; String line = null ; String newLine = System . getProperty ( "line.separator" ) ; while ( ( line = br . readLine ( ) ) != null ) { builder . append ( line ) ; builder . append ( newLine ) ; } return builder . toString ( ) ; } finally { try { if ( br != null ) br . close ( ) ; } catch ( IOException ex ) { logger . warn ( "Unable to close file " + file + ": " + ex . toString ( ) ) ; } } }
reads the whole text file into a string .
