List of utility methods to do Uncompress Byte Array
byte[] | degzip(byte[] compressed) Degzips all of the datain the specified ByteBuffer . try (InputStream is = new GZIPInputStream(new ByteArrayInputStream(compressed)); ByteArrayOutputStream out = new ByteArrayOutputStream()) { byte[] buffer = new byte[1024]; while (true) { int read = is.read(buffer, 0, buffer.length); if (read == -1) { break; out.write(buffer, 0, read); return out.toByteArray(); |
StringBuffer | uncompress(byte[] b) uncompress StringBuffer retval = new StringBuffer(); Inflater infl = new Inflater(); infl.setInput(b); int countUncompressed; byte[] buf = new byte[256]; while (true) { try { countUncompressed = infl.inflate(buf); ... |
String | uncompress(byte[] input) uncompress try { Inflater inf = new Inflater(); inf.setInput(input, 0, input.length); byte[] out = new byte[input.length * 2]; int len = inf.inflate(out); inf.end(); byte[] output = new byte[len]; System.arraycopy(out, 0, output, 0, len); ... |
String | unzip(byte zipData[]) Unzips the specified byte array. StringBuffer unzippedData = new StringBuffer(); ByteArrayInputStream byteStream = new ByteArrayInputStream(zipData); ZipInputStream zipIn = new ZipInputStream(byteStream); BufferedReader in = new BufferedReader(new InputStreamReader(zipIn)); ZipEntry entry = zipIn.getNextEntry(); String line = in.readLine(); while (line != null) { unzippedData.append(line + "\n"); ... |
Object | unzip(byte[] blob) unzip ByteArrayInputStream bais = new ByteArrayInputStream(blob); GZIPInputStream gs = new GZIPInputStream(bais); ObjectInputStream ois = new ObjectInputStream(gs); Object obj = ois.readObject(); ois.close(); bais.close(); return obj; |
byte[] | unzip(byte[] bytes) Decompresses the given byte array using the standard Java inflater (which uses the zlib compression library internally). if (bytes == null) return null; if (bytes.length == 0) return new byte[0]; Inflater inflater = new Inflater(); inflater.setInput(bytes); ByteArrayOutputStream out = new ByteArrayOutputStream(bytes.length); byte[] buffer = new byte[1024]; ... |
byte[] | unzip(byte[] bytes) unzip try { ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ZipInputStream zis = new ZipInputStream(bis); zis.getNextEntry(); return toByteArray(zis, -1); } catch (IOException e) { throw new IllegalStateException(e); |
byte[] | unzip(byte[] bytes) unzip try { GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buff = new byte[512]; int read = gis.read(buff); while (read > 0) { bos.write(buff, 0, read); read = gis.read(buff); ... |
String | unzip(byte[] bytes, String encoding) unzip if (bytes == null) { return null; } else if (bytes.length == 0) { return ""; try (ByteArrayInputStream input = new ByteArrayInputStream(bytes); GZIPInputStream gin = new GZIPInputStream(input); ByteArrayOutputStream out = new ByteArrayOutputStream();) { ... |
String | unzip(byte[] compressedByte) unzip ByteArrayOutputStream out = null; ByteArrayInputStream in = null; ZipInputStream zin = null; String decompressed = null; try { out = new ByteArrayOutputStream(); in = new ByteArrayInputStream(compressedByte); zin = new ZipInputStream(in); ... |