All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.archiveaccessor.jarfileaccessor.JarFileAccessor

java.lang.Object
   |
   +----com.ibm.archiveaccessor.filestore.FileBucketAccessor
           |
           +----com.ibm.archiveaccessor.filestore.PackagedFileBucketAccessor
                   |
                   +----com.ibm.archiveaccessor.jarfileaccessor.JarFileAccessor

public class JarFileAccessor
extends PackagedFileBucketAccessor
The JarFileAccessor class implements the bean that works with a Jar file


Constructor Index

 o JarFileAccessor()
Creates instance of the class.
 o JarFileAccessor(String)
Creates instance of the class with the content of a Jar file.

Method Index

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

Constructors

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

 o JarFileAccessor
 public JarFileAccessor(String aFileName) throws JarFileAccessorException
Creates instance of the class with the content of a Jar file. The Jar file must exist.

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

Methods

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

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

Returns:
the name of a Jar file.
 o setUseCompression
 public void setUseCompression(boolean aSwitch)
Turn on/off use of Zip compression. Fires property change event if the switch of Jar 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 setCreateManifest
 public void setCreateManifest(boolean aSwitch)
Turn on/off creation of manifest. Fires property change event if the switch of manifest creation is actually changing.

Parameters:
aSwitch - a switch of creating manifest.
 o isCreateManifest
 public boolean isCreateManifest()
Returns the switch of creating manifest.

Returns:
the switch of creating manifest.
 o setIncludeManifest
 public void setIncludeManifest(boolean aSwitch)
Turn on/off including information from a manifest file. Fires property change event if the switch of including information from a manifest file is actually changing.

Parameters:
aSwitch - a switch of creating manifest.
 o isIncludeManifest
 public boolean isIncludeManifest()
Returns the switch of including manifest information from a manifest file.

Returns:
true, if manifest created from a manifest file, false, otherwise.
 o open
 public void open(String aFileName) throws JarFileAccessorException
Opens a new Jar file. The file must exist.

Parameters:
aFileName - the name of an existing Jar file.
Throws: JarFileAccessorException
may be thrown when: - the name of the Jar file is null or empty - reading from the Jar file - processing the contents of the Jar file - opening the new Jar file but the current file is not saved.
Overrides:
open in class FileBucketAccessor
 o create
 public void create() throws JarFileAccessorException
Creates a new Jar 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 Jar file on relative pathes.

Throws: JarFileAccessorException
may be thrown when: - 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 JarFileAccessorException
Creates a new Jar file from an existing one.

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

Throws: JarFileAccessorException
may be thrown when: - the Jar file is not open - the name of the Jar file is not set - writing to the Jar file - processing the contents of the Jar file.
Overrides:
close in class FileBucketAccessor
 o add
 public void add() throws JarFileAccessorException
Adds files to the jar 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 Jar file on relative pathes.

Throws: JarFileAccessorException
may be thrown when: - the Jar 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 JarFileAccessorException
Adds named file or contents of a directory to the Jar 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 Jar 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 Jar file on relative path(es).

Parameters:
aName - the name of a file or directory to be added to the Jar file.
Throws: JarFileAccessorException
may be thrown when: - the Jar 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 JarFileAccessorException
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 Jar file.
Throws: JarFileAccessorException
may be thrown when: - the Jar 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 Jar file.
Overrides:
replace in class FileBucketAccessor
 o remove
 public void remove(String aFileName) throws JarFileAccessorException
Removes named file and its manifest entry ftom the Jar file. The file to be removed is specified by its name.

Parameters:
aFileName - the name of a file to be removed from the Jar file.
Throws: JarFileAccessorException
may be thrown when: - the Jar 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 JarFileAccessorException
Removes all files from the Jar file and all file entries from the manifest file. If create manifest property is set on then the empty manifest file would not be removed from the jar archive.

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

Throws: JarFileAccessorException
may be thrown when: - Jar 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 JarFileAccessorException
Extracts named file from the jar file. The method extracts one file from the Jar file and saves it on the disk in the default directory.

Parameters:
aFileName - the name of a file to be extracted from the Jar file.
Throws: JarFileAccessorException
may be thrown when: - Jar 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 JarFileAccessorException
Renames a file in the Jar file. The file to be renamed is specified by its name.

Parameters:
anOldName - the name of a file to be renamed in the Jar file.
aNewName - the new name of a file.
Throws: JarFileAccessorException
may be thrown when: - Jar 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 JarFileAccessorException
Checks if the specified file is present in the Jar file.

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

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

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

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

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

Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index