public static String readTextfile(final File file) throws IOException {
    final StringBuffer contents = new StringBuffer();

    final BufferedReader input = new BufferedReader(new FileReader(file));

    final String lineSeparator = System.getProperty("line.separator");

    try {
      String line = null;

      while ((line = input.readLine()) != null) {
        contents.append(line);
        contents.append(lineSeparator);
      }
    } finally {
      input.close();
    }

    return contents.toString();
  }
Reads a text file into a string.

@param file The file to read.
@return The text read from the file.
@throws IOException
java/zylib/src/main/java/com/google/security/zynamics/zylib/io/FileUtils.java