pt.jcodeutil.core.util
Class CompressUtil

java.lang.Object
  |
  +--pt.jcodeutil.core.util.CompressUtil

public class CompressUtil
extends java.lang.Object

Title: CompressUtil

Description: Utilities for creating and managing Zip file from Java.

Version:
1.0
Author:
Marco Samuel (samuelbb@sapo.pt)

Constructor Summary
CompressUtil()
           
 
Method Summary
static void unzip(java.lang.String zipfile, java.lang.String outputdir)
          Unzips zip and jar files.
static void zip(java.lang.String infile)
          Create a zipfile from the input file name.
static void zip(java.lang.String[] filesin, java.lang.String fileout)
          Create a zipfile from the input file name list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressUtil

public CompressUtil()
Method Detail

zip

public static void zip(java.lang.String[] filesin,
                       java.lang.String fileout)
                throws java.io.IOException
Create a zipfile from the input file name list.
Parameters:
infile - the input file
filesin - file list with the input files to be zipped.
fileout - name of the zip file.
Throws:
java.io.IOException - if anything happens with writing the zip.

zip

public static void zip(java.lang.String infile)
                throws java.io.IOException
Create a zipfile from the input file name. The name of the file will be the same as the input, but will have the extension ".zip".
Parameters:
infile - the input file
Throws:
java.io.IOException - if anything happens with writing the zip.

unzip

public static void unzip(java.lang.String zipfile,
                         java.lang.String outputdir)
                  throws java.io.IOException
Unzips zip and jar files.
Parameters:
zipfile - the complete path of the zip/jar file including its name.
outputdir - the output dir where the zip/jar file will be unzipped.
Throws:
java.io.IOException - if something wrong happens with the creation of the files.