code: public static void main(String[] args) {
          try {
              if (args.length == 8 || args.length == 9) {
                  String host = args[0];
                  int port = Integer.parseInt(args[1]);
                  String user = args[2];
                  String password = args[3];
                  String pid = args[4];
                  String dsid = args[5];
                  File outfile = new File(args[6]);
                  String asOfDateTime = args.length == 8 ? args[7] : null;
                  String context = args.length == 9 ? args[8] : null;
  
                  FileOutputStream outStream = new FileOutputStream(outfile);
                  Downloader downloader =
                          new Downloader(host, port, context, user, password);
  
                  downloader.getDatastreamContent(pid,
                                                  dsid,
                                                  asOfDateTime,
                                                  outStream);
              } else {
                  System.err
                          .println("Usage: Downloader host port user password pid dsid outfile [MMDDYYTHH:MM:SS] [context]");
              }
          } catch (Exception e) {
              e.printStackTrace();
              System.err.println("ERROR: " + e.getMessage());
          }
      }
docs: Test this class.