public ArchiveFile readNextTo(OutputStream outputStream) {
        ArchiveEntry entry;
        try {
            while ((entry = archiveInputStream.getNextEntry()) != null) {
                Path path = Path.fromString(requireNormalized(entry.getName(), options.allowDotSegment));
                if (isSymlink(entry)) throw new IllegalArgumentException(archiveType() + " entry " + path + " is a symbolic link, which is unsupported");
                if (entry.isDirectory()) continue;
                if (!options.pathPredicate.test(path.toString())) continue;
                if (++entriesRead > options.maxEntries) throw new IllegalArgumentException(archiveType() + " contains more files than the limit of " + options.maxEntries);

                long size = 0;
                byte[] buffer = new byte[2048];
                int read;
                while ((read = archiveInputStream.read(buffer)) != -1) {
                    totalRead += read;
                    size += read;
                    if (totalRead > options.maxSize) throw new IllegalArgumentException("Total size of " + archiveType() + " exceeds size limit of " + options.maxSize + " bytes");
                    if (read > options.maxEntrySize) {
                        if (!options.truncateEntry) throw new IllegalArgumentException("Size of " + archiveType() + " entry " + path + " exceeded entry size limit of " + options.maxEntrySize + " bytes");
                    } else {
                        outputStream.write(buffer, 0, read);
                    }
                }
                return new ArchiveFile(path, size);
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
        return null;
    }
Read the next file in this archive and write it to given outputStream. Returns information about the read archive
file, or null if there are no more files to read.
application-model/src/main/java/com/yahoo/vespa/archive/ArchiveStreamReader.java