Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.zip.GZIPInputStream;

public class Main {
    public static void main(String[] argv) throws Exception {
        String inFilename = "infile.gzip";
        GZIPInputStream in = new GZIPInputStream(new FileInputStream(inFilename));

        String outFilename = "outfile";
        OutputStream out = new FileOutputStream(outFilename);

        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }

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