List of utility methods to do Uncompress Byte Array
byte[] | unzip(byte[] output) unzip if (output == null || output.length == 0) { return output; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = new ByteArrayInputStream(output); GZIPInputStream gunzip = new GZIPInputStream(in); byte[] buffer = new byte[BUFFER_SIZE]; ... |
byte[] | unzip(byte[] src) unzip return fromGzip(src);
|
File | unzip(byte[] zipData, File directory) unzip ByteArrayInputStream bais = new ByteArrayInputStream(zipData); ZipInputStream zis = new ZipInputStream(bais); ZipEntry entry = zis.getNextEntry(); File root = null; while (entry != null) { if (entry.isDirectory()) { File f = new File(directory, entry.getName()); f.mkdir(); ... |
HashMap | unZip(byte[] zipFile) un Zip if (!(zipFile[0] == 'P' && zipFile[1] == 'K')) throw new Exception("The parameter is not a valid zip file"); HashMap<String, byte[]> ret = new HashMap<String, byte[]>(); ZipInputStream zipIn = new ZipInputStream(new ByteArrayInputStream(zipFile)); ZipEntry entry = null; while ((entry = zipIn.getNextEntry()) != null) if (!entry.isDirectory()) ret.put(entry.getName(), toByteArray(zipIn)); ... |