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.InputStream;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStream fin = new FileInputStream("a.dat");
        OutputStream fout = new FileOutputStream("a.dat.gz");
        GZIPOutputStream gzout = new GZIPOutputStream(fout);
        for (int c = fin.read(); c != -1; c = fin.read()) {
            gzout.write(c);
        }
        gzout.close();
    }
}