All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.archiveaccessor.zipfileaccessor.ZipFileAccessor

java.lang.Object
   |
   +----com.ibm.archiveaccessor.filestore.FileBucketAccessor
           |
           +----com.ibm.archiveaccessor.filestore.PackagedFileBucketAccessor
                   |
                   +----com.ibm.archiveaccessor.zipfileaccessor.ZipFileAccessor

public class ZipFileAccessor
extends PackagedFileBucketAccessor
The ZipFileAccessor class implements the bean that works with a Zip file


Constructor Index

 o ZipFileAccessor()
Creates instance of the class.
 o ZipFileAccessor(String)
Creates instance of the class with the content of a Zip file.

Method Index

 o add()
Adds files to the Zip file.
 o add(String)
Adds named file or contents of a directory to the Zip file.
 o clear()
Removes all files from the Zip file.
 o clone()
Clones the Zip file object.
 o close()
Closes the Zip file.
 o contents()
Gets the list of files of the Zip file.
 o contentsAsEnumeration()
Gets the list of files of the Zip file as an enumeration.
 o create()
Creates a new Zip file from files that are located in the default directory.
 o create(String)
Creates a new Zip file from an existing one.
 o exists(String)
Checks if the specified file is present in the Zip file.
 o extract()
Extracts all of the files from the Zip file.
 o extract(String)
Extracts named file from the Zip file.
 o getArchiveName()
Gets the name of a Zip file.
 o isUseCompression()
Returns the switch of using Zip compression.
 o open(String)
Opens a new Zip file.
 o remove(String)
Removes named file ftom the Zip file.
 o rename(String, String)
Renames a file in the Zip file.
 o replace(String)
Replaces named file in the archive by another one with the same name.
 o save()
Saves the Zip file on the disk.
 o saveAs(String)
Saves the Zip file on the disk with another name.
 o setArchiveName(String)
Sets the name of a Zip file.
 o setUseCompression(boolean)
Turn on/off use of Zip compression.

Constructors

 o ZipFileAccessor
 public ZipFileAccessor()
Creates instance of the class.

 o ZipFileAccessor
 public ZipFileAccessor(String aFileName) throws ZipFileAccessorException
Creates instance of the class with the content of a Zip file. The Zip file must exist.

Parameters:
aFileName - the name of an existing Zip file.
Throws: ZipFileAccessorException
may be thrown when: - the name of the Zip file is null or does not exist - reading from the Zip file - processing the contents of the Zip file.

Methods

 o setArchiveName
 public void setArchiveName(String aName) throws IllegalArgumentException
Sets the name of a Zip file. Fires property change event if the name of a Zip file is actually changing.

Parameters:
aName - the name of a Zip file.
Throws: IllegalArgumentException
may be thrown when the name is null.
 o getArchiveName
 public String getArchiveName()
Gets the name of a Zip file.

Returns:
the name of a Zip file.
 o setUseCompression
 public void setUseCompression(boolean aSwitch)
Turn on/off use of Zip compression. Fires property change event if the switch of Zip compression is actually changing.

Parameters:
aSwitch - a switch of using ZIP compression.
 o isUseCompression
 public boolean isUseCompression()
Returns the switch of using Zip compression.

Returns:
the switch of using ZIP compression.
 o open
 public void open(String aFileName) throws ZipFileAccessorException
Opens a new Zip file. The file must exist.

Parameters:
aFileName - the name of an existing Zip file.
Throws: ZipFileAccessorException
may be thrown when: - the name of the Zip file is null or empty - reading from the Zip file - processing the contents of the Zip file - opening the new Zip file but the current file is not saved.
Overrides:
open in class FileBucketAccessor
 o create
 public void create() throws ZipFileAccessorException
Creates a new Zip file from files that are located in the default directory. If the default directory is not set, an empty Zip file is created. All files are stored in the Zip file on relative pathes.

Throws: ZipFileAccessorException
may be thrown when (only if the current archive is not closed): - the name of the archive is not set - writing to the archive - processing the contents of the archive - an I/O error occurs.
Overrides:
create in class FileBucketAccessor
 o create
 public void create(String aFileName) throws ZipFileAccessorException
Creates a new Zip file from an existing one.

Parameters:
aFileName - the name of an existing Zip file.
Throws: ZipFileAccessorException
may be thrown when: - the name of the Zip file is null or empty - reading from the Zip file - processing the contents of the Zip file.
Overrides:
create in class FileBucketAccessor
 o close
 public void close() throws ZipFileAccessorException
Closes the Zip file.

Throws: ZipFileAccessorException
may be thrown when: - the Zip file is not open - the name of the Zip file is not set - writing to the Zip file - processing the contents of the Zip file.
Overrides:
close in class FileBucketAccessor
 o add
 public void add() throws ZipFileAccessorException
Adds files to the Zip file. The files to be added are located in the default directory. If added files have already existed in the archive they are replaced. All files are stored in the Zip file on relative pathes.

Throws: ZipFileAccessorException
may be thrown when: - the Zip file is not open - the default directory is not set - the default directory is not exist - an I/O error occurs.
Overrides:
add in class PackagedFileBucketAccessor
 o add
 public void add(String aName) throws ZipFileAccessorException
Adds named file or contents of a directory to the Zip file. The file to be added is specified by its name. If a directory name is specified as a parameter of this method then all files of this directory (including subdirectories) are added to the Zip file. If added file(s) has (have) already existed in the archive it (they) is (are) replaced. The file(s) is (are) stored in the Zip file on relative path(es).

Parameters:
aName - the name of a file or directory to be added to the Zip file.
Throws: ZipFileAccessorException
may be thrown when: - the Zip file is not open - the name of a file or directory is null or empty - an I/O error occurs.
Overrides:
add in class FileBucketAccessor
 o replace
 public void replace(String aFileName) throws ZipFileAccessorException
Replaces named file in the archive by another one with the same name.

For example, there is a file with the name com/ibm/filestore/JarFile.java in the archive. To replace it in the default directory there should be a file with the same name and signed to relative path com/ibm/filestore.

Parameters:
aFileName - the name of a file to be replaced in the Zip file.
Throws: ZipFileAccessorException
may be thrown when: - the Zip file is not open - the name of a file is null or empty - the specified file does not exist in the archive - the specified file does not exist on the disk - reading the Zip file.
Overrides:
replace in class FileBucketAccessor
 o remove
 public void remove(String aFileName) throws ZipFileAccessorException
Removes named file ftom the Zip file. The file to be removed is specified by its name.

Parameters:
aFileName - the name of a file to be removed from the Zip file.
Throws: ZipFileAccessorException
may be thrown when: - the Zip file is not open - the name of a file is null or empty - the specified file does not exist in the archive.
Overrides:
remove in class FileBucketAccessor
 o clear
 public void clear() throws ZipFileAccessorException
Removes all files from the Zip file.

Throws: ZipFileAccessorException
may be thrown when the Zip file is not open.
Overrides:
clear in class FileBucketAccessor
 o extract
 public void extract() throws ZipFileAccessorException
Extracts all of the files from the Zip file. The method extracts all of the files from the Zip file and saves them on the disk in the. default directory.

Throws: ZipFileAccessorException
may be thrown when: - Zip file is not open - the default directory is not set - the default directory is not exist - writing to the disk.
Overrides:
extract in class PackagedFileBucketAccessor
 o extract
 public void extract(String aFileName) throws ZipFileAccessorException
Extracts named file from the Zip file. The method extracts one file from the Zip file and saves it on the disk in the default directory.

Parameters:
aFileName - the name of a file to be extracted from the Zip file.
Throws: ZipFileAccessorException
may be thrown when: - Zip file is not open - the default directory is not set - the name of a file is null or empty - the specified file does not exist in the archive - writing to the disk.
Overrides:
extract in class PackagedFileBucketAccessor
 o rename
 public void rename(String anOldName,
                    String aNewName) throws ZipFileAccessorException
Renames a file in the Zip file. The file to be renamed is specified by its name.

Parameters:
anOldName - the name of a file to be renamed in the Zip file.
aNewName - the new name of a file.
Throws: ZipFileAccessorException
may be thrown when: - Zip file is not open - any of two arguments is null or empty - the specified file does not exist in the archive'.
Overrides:
rename in class FileBucketAccessor
 o exists
 public boolean exists(String aFileName) throws ZipFileAccessorException
Checks if the specified file is present in the Zip file.

Parameters:
aFileName - the name of a file to be checked in the Zip file.
Throws: ZipFileAccessorException
may be thrown when: - Zip file is not open - the name of a file is null or empty.
Overrides:
exists in class FileBucketAccessor
 o contents
 public String[] contents() throws ZipFileAccessorException
Gets the list of files of the Zip file.

Returns:
the array of file names.
Throws: ZipFileAccessorException
may be thrown when Zip file is not open.
Overrides:
contents in class FileBucketAccessor
 o contentsAsEnumeration
 public Enumeration contentsAsEnumeration() throws ZipFileAccessorException
Gets the list of files of the Zip file as an enumeration.

Returns:
enumeration of file names.
Throws: ZipFileAccessorException
may be thrown when Zip file is not open.
Overrides:
contentsAsEnumeration in class FileBucketAccessor
 o save
 public void save() throws ZipFileAccessorException
Saves the Zip file on the disk. The name of the Zip file must be set.

Throws: ZipFileAccessorException
may be thrown when: - Zip file is not open. - the name of the Zip file is not set - writing to the Zip file - processing the contents of the Zip file.
Overrides:
save in class FileBucketAccessor
 o saveAs
 public void saveAs(String aFileName) throws ZipFileAccessorException
Saves the Zip file on the disk with another name.

Parameters:
aFileName - name of Zip file.
Throws: ZipFileAccessorException
may be thrown when: - Zip file is not open. - the name of the Zip file is not set - writing to the Zip file - processing the contents of the Zip file.
Overrides:
saveAs in class FileBucketAccessor
 o clone
 public synchronized Object clone()
Clones the Zip file object.

Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index