Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

import java.util.zip.GZIPInputStream;

import com.amazonaws.util.IOUtils;

public class Main {
    static public byte[] gunzip(byte src[], byte default_value[]) {
        try {
            if (src == null)
                return default_value;

            ByteArrayOutputStream out = new ByteArrayOutputStream();

            GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(src));

            IOUtils.copy(in, out);

            in.close();
            out.close();

            return out.toByteArray();
        } catch (Exception e) {
            return default_value;
        }
    }
}