code: public static Reader getReader(final File file, String encoding) throws IOException {
          InputStream stream;
          try {
              stream = AccessController.doPrivileged(
                      new PrivilegedExceptionAction<InputStream>() {
                          @Override
                          public InputStream run() throws IOException {
                              return new FileInputStream(file);
                          }
                      }
              );
          } catch (PrivilegedActionException e) {
              throw (IOException)e.getException();
          }
  
          Reader reader;
          if (encoding != null) {
              reader = new InputStreamReader(stream, encoding);
          } else {
              reader = new InputStreamReader(stream);
          }
          return reader;
      }
docs: Returns a Reader for reading the specified file.
  
  @param file the file
  @param encoding the encoding
  @return the reader instance
  @throws IOException if an error occurred when reading resources using any I/O operations