public static void mainWithInputRedirection(String[] args, InputStream inputStream)
      throws IOException {
    BeeLine beeLine = new BeeLine();
    try {
      int status = beeLine.begin(args, inputStream);

      if (!Boolean.getBoolean(BeeLineOpts.PROPERTY_NAME_EXIT)) {
          System.exit(status);
      }
    } finally {
      beeLine.close();
    }
  }
Starts the program with redirected input. For redirected output,
setOutputStream() and setErrorStream can be used.
Exits with 0 on success, 1 on invalid arguments, and 2 on any other error

@param args
         same as main()

@param inputStream
         redirected input, or null to use standard input
beeline/src/java/org/apache/hive/beeline/BeeLine.java