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
-
ZipFileAccessor()
- Creates instance of the class.
-
ZipFileAccessor(String)
- Creates instance of the class with the content of a Zip file.
-
add()
- Adds files to the Zip file.
-
add(String)
- Adds named file or contents of a directory to the Zip file.
-
clear()
- Removes all files from the Zip file.
-
clone()
- Clones the Zip file object.
-
close()
- Closes the Zip file.
-
contents()
- Gets the list of files of the Zip file.
-
contentsAsEnumeration()
- Gets the list of files of the Zip file as an enumeration.
-
create()
- Creates a new Zip file from files that are located in the default
directory.
-
create(String)
- Creates a new Zip file from an existing one.
-
exists(String)
- Checks if the specified file is present in the Zip file.
-
extract()
- Extracts all of the files from the Zip file.
-
extract(String)
- Extracts named file from the Zip file.
-
getArchiveName()
- Gets the name of a Zip file.
-
isUseCompression()
- Returns the switch of using Zip compression.
-
open(String)
- Opens a new Zip file.
-
remove(String)
- Removes named file ftom the Zip file.
-
rename(String, String)
- Renames a file in the Zip file.
-
replace(String)
- Replaces named file in the archive by another one with the same
name.
-
save()
- Saves the Zip file on the disk.
-
saveAs(String)
- Saves the Zip file on the disk with another name.
-
setArchiveName(String)
- Sets the name of a Zip file.
-
setUseCompression(boolean)
- Turn on/off use of Zip compression.
ZipFileAccessor
public ZipFileAccessor()
- Creates instance of the class.
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.
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.
getArchiveName
public String getArchiveName()
- Gets the name of a Zip file.
- Returns:
- the name of a Zip file.
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.
isUseCompression
public boolean isUseCompression()
- Returns the switch of using Zip compression.
- Returns:
- the switch of using ZIP compression.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
clone
public synchronized Object clone()
- Clones the Zip file object.
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index