private File decompressInto(Path dir) throws IOException {
        if (!Files.isDirectory(dir)) throw new IllegalArgumentException("Not a directory: " + dir.toAbsolutePath());

        String absolutePath = dir.toFile().getAbsolutePath();
        log.log(Level.FINE, () -> "Decompress application into " + absolutePath);
        int entries = 0;
        Path tmpFile = null;
        OutputStream tmpStream = null;
        try {
            tmpFile = createTempFile(dir);
            tmpStream = Files.newOutputStream(tmpFile);
            ArchiveStreamReader.ArchiveFile file;
            while ((file = reader.readNextTo(tmpStream)) != null) {
                tmpStream.close();
                log.log(Level.FINE, "Creating output file: " + file.path());
                Path dstFile = dir.resolve(file.path().toString()).normalize();
                Files.createDirectories(dstFile.getParent());
                Files.move(tmpFile, dstFile);
                tmpFile = createTempFile(dir);
                tmpStream = Files.newOutputStream(tmpFile);
                entries++;
            }
        } finally {
            if (tmpStream != null) tmpStream.close();
            if (tmpFile != null) Files.deleteIfExists(tmpFile);
        }
        if (entries == 0)
            log.log(Level.WARNING, "Unable to decompress any entries into " + absolutePath);

        return dir.toFile();
    }
Close this stream.
@throws IOException if the stream could not be closed
configserver/src/main/java/com/yahoo/vespa/config/server/application/CompressedApplicationInputStream.java