com.myjavaworld.zip
Class Zip

java.lang.Object
  extended by com.myjavaworld.zip.Zip

public class Zip
extends Object

This class is used to create ZIP files.

Author:
Sai Pullabhotla

Constructor Summary
Zip(File file)
          Creates an instance of ZipFile.
 
Method Summary
 void addEntry(File file)
          Adds a new entry to this ZipFile.
 void addProgressListener(ProgressListener l)
           
 void addZipListener(ZipListener l)
           
 void close()
          Closes this ZipFile.
protected  void fireBeginFileEvent(File file)
           
protected  void fireEndFileEvent(File file)
           
protected  void fireProgressEvent(int progress)
           
 File getFile()
           
 com.myjavaworld.util.Filter getFilter()
           
 File getRelativeTo()
          Returns the directory, relative to which the entries will be added to this zip file.
 void open()
          Opens this ZipFile for writing.
 void removeProgressListener(ProgressListener l)
           
 void removeZipListener(ZipListener l)
           
 void setFilter(com.myjavaworld.util.Filter filter)
           
 void setRelativeTo(File relativeTo)
          Sets the directory, relative to which all entries will be added to the zip file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Zip

public Zip(File file)
Creates an instance of ZipFile.

Parameters:
file - compressed file to create
Method Detail

getFile

public File getFile()

setFilter

public void setFilter(com.myjavaworld.util.Filter filter)

getFilter

public com.myjavaworld.util.Filter getFilter()

addZipListener

public void addZipListener(ZipListener l)

removeZipListener

public void removeZipListener(ZipListener l)

addProgressListener

public void addProgressListener(ProgressListener l)

removeProgressListener

public void removeProgressListener(ProgressListener l)

fireBeginFileEvent

protected void fireBeginFileEvent(File file)

fireEndFileEvent

protected void fireEndFileEvent(File file)

fireProgressEvent

protected void fireProgressEvent(int progress)

getRelativeTo

public File getRelativeTo()
Returns the directory, relative to which the entries will be added to this zip file.

Returns:
relative directory.

setRelativeTo

public void setRelativeTo(File relativeTo)
Sets the directory, relative to which all entries will be added to the zip file.

Parameters:
relativeTo - directory, relative to which the entries will be added.

open

public void open()
          throws IOException
Opens this ZipFile for writing. This method must be called before adding any entries to this CompressedFile.

Throws:
IOException - propogated.

close

public void close()
           throws IOException
Closes this ZipFile. No more entries can be added to this ZipFile after calling this method. An attempt to add more entries after calling this method will result in an IllegalStateException.

Throws:
IOException - propogated.

addEntry

public void addEntry(File file)
              throws IOException
Adds a new entry to this ZipFile.

Parameters:
file -
Throws:
IOException


Copyright © 2000-2012 jMethods, Inc.. All Rights Reserved.