private void unpack(String packed) {
String formatedpack;
formatedpack = JSonPack.GZIPHEADER + packed.replace('!', '=').replace('$', '/').replace('*', '+');
logger.trace(formatedpack);
ByteArrayOutputStream outbuffer = new ByteArrayOutputStream(formatedpack.length());
try {
InputStream inbuffer = new Base64.InputStream(new ByteArrayInputStream(formatedpack.getBytes()), Base64.DECODE);
byte[] copybuffer = new byte[1500];
GZIPInputStream os = new GZIPInputStream(inbuffer);
int realread = os.read(copybuffer);
while (realread > 0) {
outbuffer.write(copybuffer, 0, realread);
realread = os.read(copybuffer);
}
os.close();
JrdsJSONObject json = new JrdsJSONObject(outbuffer.toString());
for(String key: json) {
Object value = json.get(key);
String newkey = JSonPack.JSONKEYS.get(new Integer(key));
params.put(newkey, new String[] { value.toString() });
logger.trace(jrds.Util.delayedFormatString("adding %s = %s", newkey, value));
}
} catch (IOException e) {
logger.error("IOException " + e, e);
} catch (JSONException e) {
logger.error("JSON parsing exception " + e);
}
logger.trace(jrds.Util.delayedFormatString("Params unpacked: %s", params));
}