private PartDirs split(final Path dir, final List<Part> parts) throws IOException {
        LOGGER.debug(() -> LogUtil.message("split() - dir: {}, parts count: {}", dir, parts.size()));
        final String inputDirName = dir.getFileName().toString();
        final FileGroup fileGroup = new FileGroup(dir);
        // Get a buffer to help us transfer data.
        final byte[] buffer = LocalByteBuffer.get();

        final Path parentDir = tempSplittingDirProvider.get();
        final List<PartDir> partDirs = new ArrayList<>();

        try (ZipFile zipFile = ZipUtil.createZipFile(fileGroup.getZip())) {
            final Iterator<ZipArchiveEntry> entries = zipFile.getEntries().asIterator();
            if (!entries.hasNext()) {
                throw new RuntimeException("Unexpected empty zip file");
            }
            ZipArchiveEntry entry = entries.next();

            int partNo = 1;
            for (final Part part : parts) {
                final String outputDirName = inputDirName + "_part_" + partNo++;
                final Path outputDir = parentDir.resolve(outputDirName);
                LOGGER.trace("Creating outputDir: {}", outputDir);
                Files.createDirectory(outputDir);
                partDirs.add(new PartDir(part, outputDir));
                final FileGroup outputFileGroup = new FileGroup(outputDir);

                // Write the zip.
                try (final ProxyZipWriter zipWriter = new ProxyZipWriter(outputFileGroup.getZip(), buffer)) {
                    String lastBaseName = null;
                    int count = 0;
                    String baseNameOut = null;
                    boolean add = true;

                    while (entry != null && add) {
                        final FileName fileName = FileName.parse(entry.getName());
                        if (!Objects.equals(fileName.getBaseName(), lastBaseName)) {
                            count++;
                            if (count <= part.items) {
                                baseNameOut = NumericFileNameUtil.create(count);
                                lastBaseName = fileName.getBaseName();
                            } else {
                                add = false;
                            }
                        }

                        if (add) {
                            final String entryName = baseNameOut + "." + fileName.getExtension();
                            // We are not changing the file, just the name, so we can work with the raw
                            // compressed stream
                            final InputStream rawInputStream = zipFile.getRawInputStream(entry);
                            zipWriter.writeRawStream(entry, entryName, rawInputStream);
                            if (entries.hasNext()) {
                                entry = entries.next();
                            } else {
                                entry = null;
                            }
                        }
                    }
                }
                // Write the entries for this split part
                final Path outputEntriesFile = outputFileGroup.getEntries();
                try (final Writer entryWriter = Files.newBufferedWriter(outputEntriesFile)) {
                    for (final ZipEntryGroup outputZipEntryGroup : part.zipEntryGroups) {
                        outputZipEntryGroup.write(entryWriter);
                    }
                }
                // Copy the meta from the split source
                LOGGER.trace(() ->
                        LogUtil.message("Copy {} => {}", fileGroup.getMeta(), outputFileGroup.getMeta()));
                Files.copy(fileGroup.getMeta(), outputFileGroup.getMeta());
            }
        }

        return new PartDirs(parentDir, partDirs);
    }
Just get a single part for the entire file group.

@param fileGroup The file group to get the zip item count and total uncompressed size from.
@return A single part to add to teh current aggregate.
@throws IOException Could be throws when reading entries.
stroom-proxy/stroom-proxy-app/src/main/java/stroom/proxy/app/handler/PreAggregator.java