List of utility methods to do ByteBuffer Ungzip
String | uncompressGZip(ByteBuffer bytes) uncompress G Zip GZIPInputStream gzipInputStream = new GZIPInputStream( new ByteArrayInputStream(bytes.array())); OutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len; while ((len = gzipInputStream.read(buf)) > 0) { out.write(buf, 0, len); gzipInputStream.close(); out.close(); String res = out.toString(); Log.i("ZipUtil", "## unpacked length: " + getKilobytes(res.length())); return res; |
String | uncompressGZip(ByteBuffer bytes) uncompress G Zip Log.w("ZipUtil", "## packed length: " + getKilobytes(bytes.capacity())); GZIPInputStream gzipInputStream = new GZIPInputStream( new ByteArrayInputStream(bytes.array())); OutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len; while ((len = gzipInputStream.read(buf)) > 0) { ... |