code: public static void mergeParts(final String partDirectory, final String outputFile,
        final VCFHeader header) throws IOException {
      // First, check for the _SUCCESS file.
      final Path partPath = asPath(partDirectory);
      final Path successPath = partPath.resolve("_SUCCESS");
      if (!Files.exists(successPath)) {
        throw new NoSuchFileException(successPath.toString(), null, "Unable to find _SUCCESS file");
      }
      final Path outputPath = asPath(outputFile);
      if (partPath.equals(outputPath)) {
        throw new IllegalArgumentException("Cannot merge parts into output with same " +
            "path: " + partPath);
      }
  
      List<Path> parts = getFilesMatching(partPath, NIOFileUtil.PARTS_GLOB,
          TabixUtils.STANDARD_INDEX_EXTENSION);
      if (parts.isEmpty()) {
        throw new IllegalArgumentException("Could not write bam file because no part " +
            "files were found in " + partPath);
      } else if (isBCF(parts)) {
        throw new IllegalArgumentException("BCF files are not supported.");
      }
  
      Files.deleteIfExists(outputPath);
  
      try (final OutputStream out = Files.newOutputStream(outputPath)) {
        boolean blockCompressed = writeHeader(out, outputPath, parts, header);
        mergeInto(parts, out);
        if (blockCompressed) {
          writeTerminatorBlock(out);
        }
      }
  
      deleteRecursive(partPath);
    }
docs: Merge part file shards produced by {@link KeyIgnoringVCFOutputFormat} into a
  single file with the given header.
  @param partDirectory the directory containing part files
  @param outputFile the file to write the merged file to
  @param header the header for the merged file
  @throws IOException