Java Uncompress Byte Array unzip(byte[] blob)

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

Description

unzip

License

Open Source License

Declaration

public static Object unzip(byte[] blob) throws IOException, ClassNotFoundException 

Method Source Code


//package com.java2s;
import java.io.ByteArrayInputStream;

import java.io.IOException;
import java.io.ObjectInputStream;

import java.util.zip.GZIPInputStream;

public class Main {
    public static Object unzip(byte[] blob) throws IOException, ClassNotFoundException {
        //logger.info("CacheServerHelper: Unzipping blob to object: " + blob);
        ByteArrayInputStream bais = new ByteArrayInputStream(blob);
        GZIPInputStream gs = new GZIPInputStream(bais);
        ObjectInputStream ois = new ObjectInputStream(gs);
        Object obj = ois.readObject();
        //logger.info("CacheServerHelper: Unzipped blob to object: " + obj);
        ois.close();//  w  ww.  j a v  a  2 s.c  o  m
        bais.close();
        return obj;
    }
}

Related

  1. degzip(byte[] compressed)
  2. uncompress(byte[] b)
  3. uncompress(byte[] input)
  4. unzip(byte zipData[])
  5. unzip(byte[] bytes)
  6. unzip(byte[] bytes)
  7. unzip(byte[] bytes)
  8. unzip(byte[] bytes, String encoding)