I'm trying to use ZSTD algorithm to compress and decompress byte array. I read the ZSTD document that will give more details about implementation, but I can't still implement sufficient method to compress and decompress byte arrays. If anyone can explain to me what I have to do it would be appreciated.
public static byte[] compressZstd(byte[] input) throws IOException {
        var compressor = new ZstdCompressor();
        byte[] compressedBuffer = new byte[1024];
        compressor.compress(input, 0, input.length, compressedBuffer, 0, 1024);
        return compressedBuffer;
    }
public static byte[] decompressZstd(byte[] input) throws IOException {
        var decompressor = new ZstdDecompressor();
        byte[] decompressedBuffer = new byte[1024];
        decompressor.decompress(input, 0, input.length, decompressedBuffer, 0, 1024);
        return decompressedBuffer;
    }