arlut.csd.Util
Class zipIt

java.lang.Object
  |
  +--arlut.csd.Util.zipIt

public class zipIt
extends java.lang.Object

This utility class allows the Ganymede server to conveniently store a bunch of pre-existing files into a zip archive for the purposes of backups.


Field Summary
(package private) static boolean debug
           
 
Constructor Summary
zipIt()
           
 
Method Summary
private static void addZipEntry(java.util.zip.ZipOutputStream zipOut, java.io.File zipIn)
          This method adds a new file to an existing ZipOutputStream.
static void createZipFile(java.io.File outputFile, java.util.Vector files)
          This method creates a zip file, and adds a vector of Files to the zip file, without capturing any path information in the file names held in the zip file.
static void createZipFile(java.lang.String outputFileName, java.util.Vector fileNames)
          This method creates a zip file, and adds a vector of Files to the zip file, without capturing any path information in the file names held in the zip file.
static void main(java.lang.String[] args)
          Test rig
static boolean zipDirectory(java.lang.String directoryPath, java.lang.String zipFileNames)
          This method takes care of zipping up a directory of files into a zip file.
static boolean zipDirectory(java.lang.String directoryPath, java.lang.String zipFileName, boolean includeZips)
          This method takes care of zipping up a directory of files into a zip file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

debug

static final boolean debug
Constructor Detail

zipIt

public zipIt()
Method Detail

zipDirectory

public static boolean zipDirectory(java.lang.String directoryPath,
                                   java.lang.String zipFileNames)
                            throws java.io.IOException

This method takes care of zipping up a directory of files into a zip file.

This method will not support subdirectories in the directory specified.. only flat files in the specific directoryPath will be zipped into zipFileName.

This method returns true if a zip file was successfully created, and false or an IOException if none could be. If there were no files in the given directory to zip, false will be returned.


zipDirectory

public static boolean zipDirectory(java.lang.String directoryPath,
                                   java.lang.String zipFileName,
                                   boolean includeZips)
                            throws java.io.IOException

This method takes care of zipping up a directory of files into a zip file.

This method will not support subdirectories in the directory specified.. only flat files in the specific directoryPath will be zipped into zipFileName.

This method returns true if a zip file was successfully created, and false or an IOException if none could be. If there were no files in the given directory to zip, false will be returned.


createZipFile

public static void createZipFile(java.lang.String outputFileName,
                                 java.util.Vector fileNames)
                          throws java.io.IOException
This method creates a zip file, and adds a vector of Files to the zip file, without capturing any path information in the file names held in the zip file.
Parameters:
outputFile - Name of the zip file to be created
files - Vector of Strings naming files to be added to the zip file.

createZipFile

public static void createZipFile(java.io.File outputFile,
                                 java.util.Vector files)
                          throws java.io.IOException
This method creates a zip file, and adds a vector of Files to the zip file, without capturing any path information in the file names held in the zip file.
Parameters:
outputFile - File object representing the zip file to be created
files - Vector of File objects representing the files to be added to the zip file.

addZipEntry

private static void addZipEntry(java.util.zip.ZipOutputStream zipOut,
                                java.io.File zipIn)
                         throws java.io.IOException
This method adds a new file to an existing ZipOutputStream.
Parameters:
zipOut - ZipOutputStream to add zipIn to.
zipIn - A File to be added to the ZipOutputStream.

main

public static void main(java.lang.String[] args)
Test rig