We are working on a VBA project. In that project we compress the string using zlib.dll and send request to the server. On the server we can't decompress that buffer.
following code which i used in java to uncompress the string
public static String decompress(byte[] str) throws IOException {
ByteArrayInputStream bais = new ByteArrayInputStream(str);
InflaterInputStream iis = new InflaterInputStream(bais);
String result = "";
byte[] buf = new byte[5];
int rlen = -1;
while ((rlen = iis.read(buf)) != -1) {
result += new String(Arrays.copyOf(buf, rlen));
}
// now result will contain "Hello World!"
System.out.println("Decompress result: " + result);
return result;
}
My Question is how can I decompress the string on the server in Java?