Example #1
0
  // Reads the contents of the passed file into a string
  public String getContents(File file) {
    StringBuilder result = new StringBuilder();

    try {
      BufferedReader input = new BufferedReader(new FileReader(file));
      String nextLine = new String();

      while ((nextLine = input.readLine()) != null) {
        result.append(nextLine);
        result.append(System.getProperty("line.separator"));
      }

      input.close();
    } catch (Exception e) {
      System.out.println("Encryption/Decryption File Error: " + e);
    }

    return result.toString();
  }