I try to compress an array of bytes using java.util.zip.GZIPOutputStream. The important thing is that it should not written into a file, but the output should be an array of bytes too.
I try that :
toConvert = 'Hello';
in = unicode2native(toConvert);
out = java.io.ByteArrayOutputStream;
gzipOutStream = java.util.zip.GZIPOutputStream(out);
output = out.toByteArray();
but it seems that the method .write for the object gzipOutStrem don't work.
in gzip.m of matlab they use :
streamCopier = ... com.mathworks.mlwidgets.io.InterruptibleStreamCopier.getInterruptibleStreamCopier;
in order to write into the GZIPOutputStream, but it seems to work only with files.
My goal is to have something like a box which compress into gzip/deflate format an array of bytes, and outputs the compressed array of bytes.
Thanks for your help