Java Uncompress Byte Array uncompress(byte[] input)

Here you can find the source of uncompress(byte[] input)

Description

uncompress

License

Open Source License

Declaration

public static String uncompress(byte[] input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.zip.Inflater;

public class Main {
    public static String uncompress(byte[] input) {
        try {// w  w  w  .j  av  a 2s . co  m
            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);

            return new String(output);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. degzip(byte[] compressed)
  2. uncompress(byte[] b)
  3. unzip(byte zipData[])
  4. unzip(byte[] blob)
  5. unzip(byte[] bytes)
  6. unzip(byte[] bytes)