List of utility methods to do Ungzip Byte Array
byte[] | unGZip(byte[] bContent) un G Zip byte[] data = new byte[MAXLENGTH]; try { ByteArrayInputStream in = new ByteArrayInputStream(bContent); GZIPInputStream pIn = new GZIPInputStream(in); DataInputStream objIn = new DataInputStream(pIn); int len = 0; int count = 0; while ((count = objIn.read(data, len, len + BUFFERSIZE)) != -1) { ... |
byte[] | ungzip(byte[] buff) ungzip GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(buff)); byte[] ungzippedRead = new byte[buff.length]; int read = gzipInputStream.read(ungzippedRead); byte[] ungzipped = new byte[read]; System.arraycopy(ungzippedRead, 0, ungzipped, 0, read); return ungzipped; |
byte[] | ungzip(byte[] bytes) ungzip ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPInputStream gis = new GZIPInputStream(bis); byte[] buffer = new byte[1024]; int readed; while ((readed = gis.read(buffer)) > 0) { bos.write(buffer, 0, readed); return bos.toByteArray(); |
byte[] | unGZip(byte[] bytes) un G Zip byte[] buffer = new byte[4096]; ByteArrayInputStream bis = new ByteArrayInputStream(bytes); GZIPInputStream gzip = new GZIPInputStream(bis); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { int r; while ((r = gzip.read(buffer, 0, buffer.length)) != -1) baos.write(buffer, 0, r); ... |
byte[] | unGzip(byte[] data) un Gzip try (GZIPInputStream zin = new GZIPInputStream(new ByteArrayInputStream(data)); ByteArrayOutputStream out = new ByteArrayOutputStream()) { data = new byte[10240]; int len; while ((len = zin.read(data)) != -1) { out.write(data, 0, len); return out.toByteArray(); ... |
byte[] | unGZip(byte[] data) un G Zip byte[] b = null; try { ByteArrayInputStream bis = new ByteArrayInputStream(data); GZIPInputStream gzip = new GZIPInputStream(bis); byte[] buf = new byte[1024]; int num = -1; ByteArrayOutputStream baos = new ByteArrayOutputStream(); while ((num = gzip.read(buf, 0, buf.length)) != -1) { ... |
byte[] | ungzip(byte[] in) Returns an gunzipped copy of the input array. ByteArrayOutputStream outStream = new ByteArrayOutputStream(EXPECTED_COMPRESSION_RATIO * in.length); GZIPInputStream inStream = new GZIPInputStream(new ByteArrayInputStream(in)); byte[] buf = new byte[BUF_SIZE]; while (true) { int size = inStream.read(buf); if (size <= 0) break; outStream.write(buf, 0, size); ... |
String | unGzip(byte[] str, String charset) un Gzip if (str == null || str.length == 0) { return null; ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = new ByteArrayInputStream(str); GZIPInputStream gunzip = new GZIPInputStream(in); byte[] buffer = new byte[256]; int n; ... |
byte[] | ungzipBestEffort(byte[] in) Returns an gunzipped copy of the input array. return ungzipBestEffort(in, Integer.MAX_VALUE);
|
byte[] | ungzipBuffer(byte[] bufInput) DeCompress the byte array using the gzip algorithm byte bufReturn[] = null; if (bufInput == null || bufInput.length == 0) return bufInput; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(bufInput.length * 2); ByteArrayInputStream bais = new ByteArrayInputStream(bufInput); GZIPInputStream gzis = new GZIPInputStream(bais); byte bufTemp[] = new byte[65535]; ... |