code: public static Object readFile(Context cx, Scriptable thisObj, Object[] args,
                                    Function funObj)
          throws IOException
      {
          if (args.length == 0) {
              throw reportRuntimeError("msg.shell.readFile.bad.args");
          }
          String path = ScriptRuntime.toString(args[0]);
          String charCoding = null;
          if (args.length >= 2) {
              charCoding = ScriptRuntime.toString(args[1]);
          }
  
          return readUrl(path, charCoding, true);
      }
docs: The readFile reads the given file content and convert it to a string
  using the specified character coding or default character coding if
  explicit coding argument is not given.
  <p>
  Usage:
  <pre>
  readFile(filePath)
  readFile(filePath, charCoding)
  </pre>
  The first form converts file's context to string using the default
  character coding.