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