libs/utils/src/main/java/co/elastic/gradle/utils/ExtractCompressedTar.java [35:54]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static InputStream uncompressedInputStream(final Path archive) throws IOException {
        InputStream result;
        InputStream imageStream = new BufferedInputStream(
                Files.newInputStream(archive, StandardOpenOption.READ)
        );
        byte[] magicBytes = new byte[4];
        imageStream.mark(4);
        if (imageStream.read(magicBytes) != 4) {
            throw new IOException("Failed to read magic bytes");
        }
        imageStream.reset();
        int magicNumber = ByteBuffer.wrap(magicBytes).order(ByteOrder.LITTLE_ENDIAN).getInt();
        // https://tools.ietf.org/html/rfc8478
        if (magicNumber == 0xFD2FB528) {
            result = new ZstdCompressorInputStream(imageStream);
        } else {
            result = imageStream;
        }
        return result;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugins/docker/docker-lib/src/main/java/co/elastic/gradle/docker/base/ExtractCompressedTar.java [35:54]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static InputStream uncompressedInputStream(final Path archive) throws IOException {
        InputStream result;
        InputStream imageStream = new BufferedInputStream(
                Files.newInputStream(archive, StandardOpenOption.READ)
        );
        byte[] magicBytes = new byte[4];
        imageStream.mark(4);
        if (imageStream.read(magicBytes) != 4) {
            throw new IOException("Failed to read magic bytes");
        }
        imageStream.reset();
        int magicNumber = ByteBuffer.wrap(magicBytes).order(ByteOrder.LITTLE_ENDIAN).getInt();
        // https://tools.ietf.org/html/rfc8478
        if (magicNumber == 0xFD2FB528) {
            result = new ZstdCompressorInputStream(imageStream);
        } else {
            result = imageStream;
        }
        return result;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



