public static CompressedApplicationInputStream createFromCompressedStream(InputStream is, String contentType, long maxSizeInBytes) {
        try {
            Options options = Options.standard().maxSize(maxSizeInBytes).allowDotSegment(true);
            return switch (contentType) {
                case ApplicationApiHandler.APPLICATION_X_GZIP ->
                        new CompressedApplicationInputStream(ArchiveStreamReader.ofTarGzip(is, options));
                case ApplicationApiHandler.APPLICATION_ZIP ->
                        new CompressedApplicationInputStream(ArchiveStreamReader.ofZip(is, options));
                default -> throw new BadRequestException("Unable to decompress");
            };
        } catch (UncheckedIOException e) {
            throw new InternalServerException("Unable to create compressed application stream", e);
        }
    }
Create an instance of a compressed application from an input stream.

@param is   the input stream containing the compressed files.
@param contentType the content type for determining what kind of compressed stream should be used.
@param maxSizeInBytes the maximum allowed size of the decompressed content
@return An instance of an unpacked application.
configserver/src/main/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStream.java