.. / ** * @ (#) 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; / ** * http posts in 9CBS : //community.9cbs.net/expert/topic/3316/3316352.xml? Temp = .2301905 See * About ZIP compressed files, mainly demonstrates that the file path is compressed in Zip compression Go in * * @Author odt * @version 1.0 04/08/27 * / public class zipfile {public static void main (string [] args) {arraylist filenames = new arraylist (); // store file name, not containing path name ArrayList files = 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 } OutputStream.close ();} catch (IOException ioe) {ioe.printStackTrace ();}} static void listFile (File parentFile, List nameList, List fileList) {if (parentFile.isDirectory ()) {File [] files = Parentfile.listfiles (); for (int loop = 0; loop http://blog.9cbs.net/iceandfire/