Java Uncompress Byte Array unzip(byte[] datas)

Here you can find the source of unzip(byte[] datas)

Description

unzip

License

Apache License

Declaration

private static byte[] unzip(byte[] datas) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

import java.util.zip.InflaterInputStream;

public class Main {
    private static byte[] unzip(byte[] datas) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayInputStream in = new ByteArrayInputStream(datas);
        InflaterInputStream iin = new InflaterInputStream(in);
        byte[] buffer = new byte[256];
        int n;/*from   w  w w .  ja v  a  2  s . c o m*/
        while ((n = iin.read(buffer)) >= 0) {
            out.write(buffer, 0, n);
        }
        return out.toByteArray();
    }
}

Related

  1. unzip(byte[] content)
  2. unZip(byte[] contents)
  3. unzip(byte[] data)
  4. unZip(byte[] data)
  5. unzip(byte[] data)
  6. unzip(byte[] in)
  7. unZip(byte[] input)
  8. unzip(byte[] output)
  9. unzip(byte[] src)