The following Matlab newsreader threads:
as well as the in these threads mentioned Matlab File Exchange contributions:
plus this Matlab File exchange contribution:
addressed me to a possible workaround.
Workaround: Use java.io.ByteArrayOutputStream() and java.util.zip.DeflaterOutputStream(,)
import java.util.zip.Inflater
% Encode a String into bytes
inputString = javaObject('java.lang.String','blahblahblah??');
input = inputString.getBytes('UTF-8');
% Compress the bytes
output = java.io.ByteArrayOutputStream();
compresser = java.util.zip.Deflater();
outstrm = java.util.zip.DeflaterOutputStream(output,compresser);
outstrm.write(input);
compresser.finish();
outstrm.close();
% output to ByteArray
output.toByteArray()
% output to String
output.toString()
Still, I have no explanation why the Matlab line of code:
compressedDataLength = compresser.deflate(output);
in the context of the above question, should produce an error.