Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.io.ByteArrayOutputStream;

import java.io.IOException;

import java.util.zip.GZIPOutputStream;

public class Main {

    static public final byte[] gzipBytes(byte[] bytes) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        GZIPOutputStream gout = new GZIPOutputStream(out);
        try {
            gout.write(bytes);
        } finally {
            gout.close();
        }
        return out.toByteArray();
    }
}