java - Unzip base64 encoding -
i have text: http://pastebin.com/qdcqvrhk
it's zipped encoded base64, need decode text, @ end receive xml data.
i try to:
public static byte[] decompress(string content) throws ioexception { byte[] compressed = base64.decode(content,base64.default); byte[] decodedcontent = base64.decode(content, base64.default); byte[] bytes = null; zipinputstream zipstream = new zipinputstream(new bytearrayinputstream(decodedcontent)); try{ zipentry entry = null; while ((entry = zipstream.getnextentry()) != null) { bytearrayoutputstream baos = new bytearrayoutputstream(); byte[] buffer = new byte[1024]; int count; while ((count = zipstream.read(buffer)) != -1) { baos.write(buffer, 0, count); } baos.close(); zipstream.closeentry(); bytes = baos.tobytearray(); } return bytes; }finally{ zipstream.close(); } }
Comments
Post a Comment