code: protected Object evaluate(InputStream inStrm, String scriptName) {
          InputStreamReader streamReader = new InputStreamReader(inStrm, StandardCharsets.UTF_8);
          BufferedReader br = new BufferedReader(streamReader);
          StringBuilder sb = new StringBuilder();
          String line;
          try {
              while ((line = br.readLine()) != null) {
                  sb.append(line).append("\n");
              }
          } catch (IOException e) {
              throw new RuntimeException("error while reading javascript from stream", e);
          }
          String script = sb.toString();
          return evaluate(script, scriptName);
      }
docs: Reads and evaluates the code at the passed input stream. The stream is
  read to its end, but is not closed.
  
  @param inStrm Input stream for reading the script to be evaluated.
  @param scriptName for error reporting purposes.
  @return Result of evaluating the code at {@code inStrm}.