.ArchiveAccessor V 1.0
ZipFileAccessor Bean
This part of the document covers the following information:
This document describes the ZipFileAccessor Bean. It
is intended for application assemblers who can use the component in a visual builder as
well as in manual programming. It is assumed
that they are already familiar with JavaBeans. If terms like property, event, method,
introspection, or serialization are unfamiliar to them, they may refer to the JavaBeans documentation or take
the JavaBeans tutorial.
Guide Conventions
See the Guide
Conventions part from the Introduction section of the ArchiveAccessor
Bean Suite User's Guide.
Guide Organization
Introduction - introduces the
user to the ZipFileAccessor Bean. Provides information like intended audience, guide
conventions, guide organization, and copyrights.
Bean at a Glance - gives a brief
overview of the bean. Also provides information on commonly used methods, events, and
properties.
Bean Description - explains the bean
in detail. Provides information on dependencies, security, customization if any, etc.
Summaries - summarizes
properties, methods, and events of the bean.
Reference to Properties - links to
respective properties.
Reference to Methods - links to
respective methods.
Reference to Events - links to
respective events.
Support Classes - provides
information on support classes.
See Also - links to related topics.
Copyright © 1998 IBM Corp.
All rights reserved.
IBM and VisualAge are trademarks of International Business Machines
in the United States and/or other countries.
* Java and all Java-based trademarks and logos are trademarks or
registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
Copyright © 1997 The Open Group
Permission to use, copy, modify, and
distribute this software and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all copies and that both the
copyright notice and this permission notice appear in supporting documentation, and that
the name of ("TOG") or The Open Group not be used in advertising or publicity
pertaining to distribution of the software without specific, written prior permission.
THE OPEN GROUP DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TOG BE LIABLE FOR
ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
The Open Group Research Institute
MoaJar (unencumbered) 3/20/1997
Provides the following information:
public ZipFileAccessor
extends PackagedFileBucketAccessor
The ZipFileAccessor class implements the bean that works with a Zip
file.
Key Properties
Commonly Used Methods
Commonly Used Events
The Bean Description portion of this document provides the following
information:
The ZipFileAccessor Bean is a
non-visual component that gives the application assembler an easy access to a Zip file.
Features of the ZipFileAccessor Bean
are as follows:
add files to a Zip file,
replace files in a Zip file
remove files from a Zip file,
extract files from a Zip file,
rename files in a Zip file,
get contents of a Zip file.
Application assemblers (programmers) can perform any of the
above mentioned operations by calling corresponding APIs.
ZipFileAccessorBeanInfo provides information on properties, events, and methods.
The application assembler can customize the following properties of
the ZipFileAccessor Bean:
Name |
Datatype |
[Constrained
| Bound|Indexed]
[expert] |
Description |
Default
value |
Access
type |
automaticSave |
boolean |
bound,
expert |
indicates whether
a file bucket is automatically saved or not when it being closed |
true |
(w/r) |
defaultDirectory |
String |
bound |
default directory
for getting files specified with relative names to be saved in a packaged
archive file |
user's current
working directory |
(w/r) |
archiveName |
String |
bound |
archive file name |
"untitled.zip" |
(w/r) |
useCompression |
boolean |
bound |
switch for using a
Zip compression |
true |
(w/r) |
As Source:
EventListener Interfaces -
PropertyChangeListener
EventListener Objects -
PropertyChangeEvent
 |
|
- archiveName [bound] -
archive file name
To customize the bean to set this property, one should utilize either system-independent
file separator ('/') or double back slash.
If the archive name is not defined, it is saved with default name "untitled.zip".
If the archive name is defined as "blank" or "empty", then it is saved
with name " .zip". Such a name, from the viewpoint of
the system, is quite all right.
- Type: String
- Default value: "untitled.zip"
- Get: getArchiveName()
- Set: setArchiveName(String)
-
- automaticSave [bound,
expert] - indicates whether a file bucket is automatically saved
or not when it being closed.
- Type: boolean
- Default value: true
- Get: isAutomaticSave()
- Set: setAutomaticSave(boolean)
-
- defaultDirectory
[bound] - default directory to get the
files specified with relative names to be saved in a packaged archive file. To customize the bean to set this
property, one should utilize either system-independent file separator ('/') or double back
slash.
- Type: String
- Default value: user's current working directory
- Get: getDefaultDirectory()
- Set: setDefaultDirectory(String)
-
- useCompression
[bound] - switch for using a Zip compression.
- Type: boolean
- Default value: true
- Get: isUseCompression()
- Set: setUseCompression(boolean)
 |
|
- add
- public void add() throws ZipFileAccessorException
- Adds files to a Zip file. Files to be added are located in a default
directory. All files are stored in a Zip file on relative paths. If added files exist
already in an archive, they are replaced. When
the automaticSave
property is set to true, the archive is saved on the disk.
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - default directory is not set,
- - default directory does not exist,
- - I/O error occurs.
- Overrides:
- add in class PackagedFileBucketAccessor
-
- add
- public void add(String aName) throws ZipFileAccessorException
- Adds a named file or contents of a directory to a Zip file. The file
to be added is specified by its name. If a directory name is specified as a parameter of
this method, all files of this directory (including subdirectories) are added to the Zip
file. The file(or files) is stored in the Zip file on a relative path (or paths). A
parameter specifying a file or a directory to add should unambiguously determine a file or
directory place on the disk. If an incomplete file or directory name is given, i.e.
the name contains a relative path, searching for the file starts from the Default
Directory. Otherwise, a complete file or directory name should be set, i.e. it should
contain an absolute path. If an added file (or files) exists already in the archive,
it (or they) is replaced. When the automaticSave property is set
to true, the
archive will be saved on the disk.
- Parameters:
- aName - file name to be added to a Zip
file
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - file or directory name is null or empty,
- - I/O error occurs.
- Overrides:
- add in class FileBucketAccessor
-
- clear
- public void clear() throws ZipFileAccessorException
- Removes all files from a Zip file. When
the automaticSave
property is set to true, the archive is saved on the disk.
- Throws: ZipFileAccessorException
- May be thrown when a Zip file is not opened.
- Overrides:
- clear in class FileBucketAccessor
-
- clone
- public synchronized Object clone()
- Clones a Zip file object.
- Overrides:
- clone in class Object
-
- isUseCompression
- public boolean isUseCompression()
- Returns a switch for using a Zip compression. If a returned value is
equal to true, the compression is
used; if it is equal to false, it is
not used.
- Returns:
- switch for using a Zip compression.
- close
- public void close() throws ZipFileAccessorException
- Closes a Zip file.
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- Zip file name is not set,
- - writing to a Zip file,
- - processing contents of a Zip file.
- Overrides:
- close in class FileBucketAccessor
-
- contents
- public String[] contents() throws ZipFileAccessorException
- Gets a list of files of a Zip file.
- Returns:
- array of file names
- Throws: ZipFileAccessorException
- May be thrown when a Zip file is not opened.
- Overrides:
- contents in class FileBucketAccessor
-
- contentsAsEnumeration
- public Enumeration contentsAsEnumeration() throws ZipFileAccessorException
- Gets a list of files of a Zip file as enumeration.
- Returns:
- enumeration of file names
- Throws: ZipFileAccessorException
- May be thrown when a Zip file is not opened.
- Overrides:
- contentsAsEnumeration in class FileBucketAccessor
-
- create
- public void create() throws ZipFileAccessorException
- Creates a new Zip file from files that are located in a default
directory. All files are stored in the Zip file on relative paths. When the automaticSave property is set to true, the archive is saved on the disk.
- Throws: ZipFileAccessorException
- May be thrown only if a current archive is not closed:
- - archive name is not set,
- - writing to an archive,
- - processing contents of an archive,
- - I/O error occurs.
- Overrides:
- create in class FileBucketAccessor
-
- create
- public abstract void create(String aFileName) throws ZipFileAccessorException
- Creates a new Zip file from an existing one. All files are stored in the Jar file on relative paths. When the automaticSave property is set
to true, the
archive will be saved on disk.
- Parameters:
- aFileName - name of an existing Zip
file
- Throws: ZipFileAccessorException
- May be thrown when
- - archive name is not set,
- - reading from an archive,
- - writing to an archive,
- - processing contents of an archive.
- Overrides:
- create in class FileBucketAccessor
-
- exists
- public abstract boolean exists(String aFileName) throws ZipFileAccessorException
- Checks if a specified file name is present in a Zip file.
- Parameters:
- aFileName - file nameto be checked
in a Zip file
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - file name is null or empty.
- Overrides:
- exists in class FileBucketAccessor
-
- extract
- public void extract() throws ZipFileAccessorException
- Extracts all files from a Zip file. The method extracts all
files from the Zip file and saves them on the disk in a default directory.
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - default directory is not set,
- - default directory does not exist,
- - writing to the disk.
- Overrides:
- extract in class PackagedFileBucketAccessor
-
- extract
- public void extract(String aFileName) throws ZipFileAccessorException
- Extracts a named file from a Zip file. The method extracts one file
from a Zip file and saves it on the disk in a default directory.
- Parameters:
- aFileName - file name to be
extracted from a Zip file
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - default directory is not set,
- - file name is null or empty,
- specified file does not exist in an archive,
- - writing to the disk.
- Overrides:
- extract in class PackagedFileBucketAccessor
-
- getArchiveName
- public String getArchiveName()
- Gets a file bucket name.
-
- open
- public void open(String aFileName) throws ZipFileAccessorException
- Opens a new Zip file. The file must exist. A parameter specifying a
file to open should unambiguously determine a file place on the disk. If an
incomplete file name is given, i.e. the file name contains a relative path, we start
searching for the file from a current system directory. Otherwise, a complete file
name should be set, e.i. it should contain an absolute path.
- Parameters:
- aFileName - name of the existing Zip file
- Throws: ZipFileAccessorException
- May be thrown when
- Zip file name is null or empty,
- reading from a Zip file,
- processing contents of a Zip file,
- opening a new Zip file, but a current file is not saved,
- new Zip file does not exist.
- Overrides:
- open in class FileBucketAccessor
-
- rename
- public void rename(String anOldName,
-
String aNewName) throws ZipFileAccessorException
- Renames a file in a Zip file. The file to be renamed is specified by
its name. When the automaticSave property is set to true, the archive is saved on the disk.
- Parameters:
- anOldName - file name to be renamed
in a Zip file
- aNewName - new name of a file
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - specified file does not exist in an archive,
- - any of the two arguments is null or empty.
- Overrides:
- rename in class FileBucketAccessor
-
- replace
- public void replace(String aFileName) throws ZipFileAccessorException
- Replaces a named file in an archive with another one with the same
name.
For example, there is a file with name com/ibm/filestore/ZipFile.java in an archive. To
replace it in a default directory, there should be a file with the same name and signed to
relative path com/ibm/filestore.
When the automaticSave property is set to true, the archive will be saved on the disk.
- Parameters:
- aFileName - file name to be replaced
in a Zip file
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - file name is null or empty,
- - specified file does not exist in an archive,
- - specified file does not exist on the disk,
- - reading a Zip file.
- Overrides:
- replace in class FileBucketAccessor
-
- remove
- public void remove(String aFileName) throws ZipFileAccessorException
- Removes a named file from a Zip file. The file to be removed is
specified by its name. When the automaticSave property is set to true, the archive is saved on
the disk.
- Parameters:
- aFileName - file name to be removed
from a Zip file
- Throws: ZipFileAccessorException
- May be thrown when
- - file name is null or empty,
- - specified file does not exist in an archive,
- - Zip file is not opened.
- Overrides:
- remove in class FileBucketAccessor
-
- save
- public void save() throws ZipFileAccessorException
- Saves a Zip file on the disk. The name of the Zip file must be set.
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - Zip file name is not set,
- - writing to a Zip file,
- - processing contents of a Zip file.
- Overrides:
- save in class FileBucketAccessor
-
- saveAs
- public void saveAs(String aFileName) throws ZipFileAccessorException
- Saves a Zip file on the disk with another name. A parameter
specifying the archive name to save should unambiguously determine the archive place on
the disk. If an incomplete archive name is given, i.e. the name contains a relative
path, the archive should be saved in a current system directory. Otherwise, a complete
archive name should be set, e.i. it should contain an absolute path.
- Parameters:
- aFileName - Zip file name
- Throws: ZipFileAccessorException
- May be thrown when
- - Zip file is not opened,
- - Zip file name is not set,
- - writing to a Zip file,
- - processing contents of a Zip file.
- Overrides:
- saveAs in class FileBucketAccessor
-
- setArchiveName
- public void setArchiveName(String aName) throws
IllegalArgumentException
- Sets a Zip file nmae. Fires the PropertyChange event if the name of
the Zip file is actually changing.
- Parameters:
- aName - Zip file name
- Throws: IllegalArgumentException
- May be thrown when a name is null.
- Overrides:
- setArchiveName in class FileBucketAccessor
-
- setUseCompression
- public void setUseCompression(boolean aSwitch)
- Turns on/off the use of a Zip compression. Fires the PropertyChange
event if an aSwitch property value
of the Zip compression is actually changing. If an argument is equal to true, the
compression algorithm is used while saving the archive on the disk. If aSwitch is equal to
false, the archive can be saved without the compression algorithm.
- Parameters:
- aSwitch - switch for using a Zip
compression
-
- ZipFileAccessor
- public ZipFileAccessor()
- Creates an instance of the class.
-
- ZipFileAccessor
- public ZipFileAccessor(String aFileName) throws ZipFileAccessorException
- Creates an instance of the class with contents of a Zip file.
The Zip file must exist.
- Parameters:
- aFileName - name of the existing
Zip file
- Throws: ZipFileAccessorException
- May be thrown when
- Zip file name is null or does not exist,
- reading from a Zip file,
- processing contents of a Zip file.
 |
|
The ZipFileAccessor Bean fires the PropertyChange event if one of
the bound properties is actually changing. Listeners get registered for the
post-notifications of bound properties with addPropertyChangeListener().
As Source:
EventListener Interfaces -
PropertyChangeListener
EventObject -
PropertyChangeEvent
- Base64
- FilenameFilter
- Folder
- FolderBucket
- JarBucket
- JarFile
- Manifest
- ManifestSection
- Matching
- Reads
- ZipBucket
- ZipFile
- FileBucketAccessor
- PackagedFileBucketAccessor
- FileBucketAccessorException
- ZipFileAccessorException
Go back to
 |
ArchiveAccessor
Bean Suite Documentation Index
|
Last Modified : 08/28/98