code: public static void sortFile(File sortDir, File inputFile, File outputFile, Comparator<String> comparator,
                                  boolean skipHeader, long maxBytes, int mergeFactor) {
          // validation
          if(comparator == null) {
              comparator = Lexical.ascending();
          }
  
          // steps
          List<File> splitFiles = split(sortDir, inputFile, maxBytes, skipHeader);
          List<File> sortedFiles = sort(sortDir, splitFiles, comparator);
          merge(sortDir, sortedFiles, outputFile, comparator, mergeFactor);
      }
docs: Sort a file, write sorted data to output file.
  @param inputFile input file
  @param outputFile output file
  @param comparator comparator used to sort rows