package com.itbuluoge.nio;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.util.zip.GZIPOutputStream;

public class Zip {

/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {

/*java压缩文件*/
BufferedReader in=new BufferedReader(new FileReader("data.out"));
BufferedOutputStream out=new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream("test.zip")));

int c;
while((c=in.read())!=-1)
{
out.write(c);
}

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

}

}