[Original] Write an example of only compressed files
/ ** * @ (#) zipfile.java * * Copyright 2004 OpenSource Develop Team. All Rights Reserved. * / Package com.opensource.zip;
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.zip.ZipEntry Import java.util.zip.zipoutputstream;
/ ** * In 9CBS post http://community.9cbs.net/expert/topic/3316/3316352.xml?temp =.2301905 See * About ZIP compressed files, mainly demo in Zip in this class Compression can not compress file path to * * @Author odt * @version 1.0 04/08/27 * / public class zipfile {public static void main (string [] args) {arraylist filenames = new arraylist (); // store the file name, not the name of ArrayList files containing path = new ArrayList (); // store the file object try {FileOutputStream fileOut = new FileOutputStream ( "E: /ZipOutOfPath.zip"); ZipOutputStream outputStream = new ZipOutputStream (fileOut); file Rootfile = new file ("e: / temp"); Listfile (rootfile, filenames, files); for (int loop = 0; loop