Java examples for File Path IO:GZIP
create GZIP Archive
// This program is free software: you can redistribute it and/or modify it //package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.GZIPOutputStream; public class Main { public static void createArchive(String outputFilename, String inputFile) throws IOException { GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream( outputFilename));// www . j ava 2s . co m byte[] buf = new byte[1024]; File file = new File(inputFile); FileInputStream in = new FileInputStream(file); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); } }