GZIPOutputStream
import java.io.*;
import java.util.zip.*;
import com.macfaq.io.*;
public class GZipper {
public final static String GZIP_SUFFIX = ".gz";
public static void main(String[] args) {
for (int i = 0; i < args.length; i++) {
try {
FileInputStream in = new FileInputStream(args[i]);
FileOutputStream fout = new FileOutputStream(args[i] + GZIP_SUFFIX);
GZIPOutputStream out = new GZIPOutputStream(fout);
byte[] buffer = new byte[256];
while (true) {
int bytesRead = in.read(buffer);
if (bytesRead == -1) break;
out.write(buffer, 0, bytesRead);
}
out.close();
}
catch (IOException e) {
System.err.println(e);
}
}
}
}