|
|
|
|
org.eclipse.rse.services.clientserver.archiveutils
Class SystemZipHandler
java.lang.Object
org.eclipse.rse.services.clientserver.archiveutils.SystemZipHandler
-
All Implemented Interfaces:
-
ISystemArchiveHandler
-
Direct Known Subclasses:
-
SystemJarHandler
-
public class SystemZipHandler
- extends
Object
- implements
ISystemArchiveHandler
Implements an ISystemArchiveHandler for ZIP files.
Constructor Summary
|
SystemZipHandler
(
File file)
Creates a new SystemZipHandler and associates it with file . |
Method Summary
|
void
|
add
(
File[] files,
String virtualPath,
String[] names,
ISystemOperationMonitor archiveOperationMonitor)
A generalization of the add method. |
void
|
add
(
File[] files,
String virtualPath,
String[] names,
String[] sourceEncodings,
String[] targetEncodings,
boolean[] isText,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
Same as add(File[] files, String virtualPath, String[] names, String[] encodings) but you can choose whether
or not you want to leave the zipfile open after return. |
void
|
add
(
File[] files,
String virtualPath,
String[] names,
String[] sourceEncodings,
String[] targetEncodings,
boolean[] isText,
ISystemOperationMonitor archiveOperationMonitor)
A generalization of the add method. |
void
|
add
(
File file,
String virtualPath,
String name,
ISystemOperationMonitor archiveOperationMonitor)
Compresses the file file and adds it to the archive, placing
it in the virtual directory virtualPath . |
void
|
add
(
File file,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
Compresses the file file and adds it to the archive, saving
it in the encoding specified by encoding if the isText is
true. placing it in the virtual directory virtualPath . |
void
|
add
(
File file,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
ISystemFileTypes registry,
ISystemOperationMonitor archiveOperationMonitor)
Compresses the file file and adds it to the archive, saving
it in the encoding specified by encoding if the isText is
true. placing it in the virtual directory virtualPath . |
void
|
add
(
InputStream stream,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
Compresses the bytes in the InputStream stream and adds them
as an entry to the archive, saving them in the encoding specified by
encoding if isText is true, and placing it in
the virtual directory virtualPath . |
protected
ZipEntry
|
appendBytes
(
InputStream stream,
ZipOutputStream dest,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText)
Compresses the contents of stream , adding them to the
ZipFile managed by dest . |
protected
ZipEntry
|
appendEmptyFile
(
ZipOutputStream dest,
String name)
Works similarly to appendFile, except no actual data is appended
to the zipfile, only an entry is created. |
protected
ZipEntry
|
appendFile
(
File file,
ZipOutputStream dest,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText)
Compresses the contents of file , adding them to the ZipFile
managed by dest . |
protected void
|
buildTree
()
Builds the virtual file system tree out of the entries in
the zipfile. |
protected boolean
|
closeZipFile
()
|
void
|
create
()
Turns the archive that this handler represents into a new, empty archive. |
protected void
|
createFile
(
File file)
Create an empty file, also creating parent folders if necessary. |
void
|
createFile
(
String name,
ISystemOperationMonitor archiveOperationMonitor)
Creates a new, empty file in the archive. |
void
|
createFolder
(
String name,
ISystemOperationMonitor archiveOperationMonitor)
Creates a new, empty folder in the archive. |
protected
ZipEntry
|
createSafeZipEntry
(
String name)
A "safe" ZipEntry is one whose virtual path does not begin with a
"/". |
protected boolean
|
createVirtualObject
(
String name,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
Creates a new, empty object in the virtual File system, and creates an
empty file or folder in the physical zip file. |
boolean
|
delete
(
String fullVirtualName,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
Same as delete(String fullVirtualName) but you can choose whether
or not you want to leave the zipfile open after return. |
boolean
|
delete
(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Deletes the entry fullVirtualName from the archive, and
returns whether or not the deletion was successful. |
protected void
|
delTree
(
VirtualChild vc)
Deletes all the children of the directory VirtualChild vc
recursively down to the leaves. |
boolean
|
exists
()
Check if the archive handler implementation associated with this class
exists. |
boolean
|
exists
(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Check whether a given virtual node exists in an archive. |
void
|
extractVirtualDirectory
(
String dir,
File destinationParent,
File destination,
ISystemOperationMonitor archiveOperationMonitor)
Extracts the directory dir (and its children) from the
archive and places the results in the directory
destinationParent . |
void
|
extractVirtualDirectory
(
String dir,
File destinationParent,
File destination,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
Extracts the directory dir (and its children) from the
archive and places the results in the directory
destinationParent . |
void
|
extractVirtualDirectory
(
String dir,
File destinationParent,
ISystemOperationMonitor archiveOperationMonitor)
Extracts the directory dir (and its children) from the
archive and places the results in the directory
destinationParent . |
void
|
extractVirtualDirectory
(
String dir,
File destinationParent,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
Extracts the directory dir (and its children) from the
archive and places the results in the directory
destinationParent . |
void
|
extractVirtualFile
(
String fullVirtualName,
File destination,
boolean closeZipFile,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
Same as extractVirtualFile(String fullVirtualName, File destination) but you can choose whether
or not you want to leave the zipfile open after return. |
void
|
extractVirtualFile
(
String fullVirtualName,
File destination,
ISystemOperationMonitor archiveOperationMonitor)
Extracts the virtual file named fullVirtualName from the
archive, placing the results in destination . |
void
|
extractVirtualFile
(
String fullVirtualName,
File destination,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
Extracts the virtual file named fullVirtualName from the
archive, placing the results in destination . |
protected void
|
fillBranch
(
ZipEntry next)
Populates an entire branch of the tree that comprises the
virtual file system. |
protected void
|
fillBranchAfterRename
(
ZipEntry next,
String oldName)
Populates an entire branch of the tree that comprises the
virtual file system. |
void
|
fullRename
(
String fullVirtualName,
String newFullVirtualName,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
Same as fullRename(String fullVirtualName, String newFullVirtualName) but
you can choose whether or not you want to leave the zipfile open after
return. |
void
|
fullRename
(
String fullVirtualName,
String newFullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Replaces the full name and path of the entry fullVirtualName
with the new full name and path newFullVirtualName . |
File
|
getArchive
()
Return the archive that this handler deals with. |
String
|
getArchiveComment
()
Get the comment associated with an archive. |
String
|
getClassification
(
String fullVirtualName)
Get the classification for the entry with the given path. |
String
|
getClassification
(
String fullVirtualName,
boolean closeZipFile)
Same as getClassification(String), but you can choose whether to leave the zip file
open after the method is closed. |
String
|
getCommentFor
(
String fullVirtualName)
Get the user-defined comment for a specific entry in the archive. |
String
|
getCommentFor
(
String fullVirtualName,
boolean closeZipFile)
same as getCommentFor(String) but you can choose whether or not to leave
the zipfile open after the method is closed |
long
|
getCompressedSizeFor
(
String fullVirtualName)
Get the amount of space taken up by a specific entry in the archive when
it is in compressed form. |
long
|
getCompressedSizeFor
(
String fullVirtualName,
boolean closeZipFile)
same as getCompressedSizeFor(String) but you can choose whether or not to leave
the zipfile open after the method is closed |
String
|
getCompressionMethodFor
(
String fullVirtualName)
Get the method used to compress a specific entry in the archive. |
String
|
getCompressionMethodFor
(
String fullVirtualName,
boolean closeZipFile)
same as getCompressionMethodFor(String) but you can choose whether or not to leave
the zipfile open after the method is closed |
File[]
|
getFiles
(
String[] fullNames,
ISystemOperationMonitor archiveOperationMonitor)
Extracts and returns the specified list of virtual files from the
archive. |
long
|
getSizeFor
(
String fullVirtualName)
Return the size for an archive node. |
long
|
getSizeFor
(
String fullVirtualName,
boolean closeZipFile)
Same as
getSizeFor(String) but allows to specify whether to
close the zip file or not. |
String
|
getStandardName
(
VirtualChild vc)
Get the archive-type specific standard name for the VirtualChild
vc . |
long
|
getTimeStampFor
(
String fullVirtualName)
Return the timestamp for an archive node. |
long
|
getTimeStampFor
(
String fullVirtualName,
boolean closeZipFile)
Same as getTimeStampFor(String fullVirtualName) but you can choose whether
or not you want to leave the zipfile open after return. |
VirtualChild[]
|
getVirtualChildFolders
(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Return those children of a specified node in an archive, which are
folders. |
VirtualChild[]
|
getVirtualChildren
(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Return the children of a specified node in an archive. |
VirtualChild[]
|
getVirtualChildrenList
(boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
Same as getVirtualChildrenList(), but you can choose whether to leave the
zip file open or closed upon return. |
VirtualChild[]
|
getVirtualChildrenList
(
ISystemOperationMonitor archiveOperationMonitor)
Return a flat list of entries in an archive. |
VirtualChild[]
|
getVirtualChildrenList
(
String parent,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
Same as getVirtualChildrenList(String parent) but you can choose whether
or not you want to leave the zipfile open after return. |
VirtualChild[]
|
getVirtualChildrenList
(
String parent,
ISystemOperationMonitor archiveOperationMonitor)
Return a flat list of entries in an archive, whose full paths begin with
the given parent prefix. |
VirtualChild
|
getVirtualFile
(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Return an archive node specified by a given virtual path. |
static boolean
|
listAllFiles
(
File parent,
HashSet found,
ISystemOperationMonitor archiveOperationMonitor)
Helper method. populates found with a collapsed list of
all nodes in the subtree of the file system rooted at parent . |
void
|
move
(
String fullVirtualName,
String destinationVirtualPath,
ISystemOperationMonitor archiveOperationMonitor)
Moves the entry fullVirtualName to the location specified by
destinationVirtualPath , while leaving the entry with the
same name as before. |
protected boolean
|
openZipFile
()
Opens the zipfile that this handler manages. |
protected void
|
populate
(
String key,
VirtualChild value)
|
protected boolean
|
recreateZipDeleteEntries
(
VirtualChild[] vcList,
ZipOutputStream dest,
HashSet omitChildren,
ISystemOperationMonitor archiveOperationMonitor)
Recreates a zip file from a list of virtual children, optionally omitting
a group of children whose names are in the Set omitChildren |
protected boolean
|
recreateZipRenameEntries
(
VirtualChild[] vcList,
ZipOutputStream dest,
HashMap names,
ISystemOperationMonitor archiveOperationMonitor)
Recreates a zip file from a list of virtual children, but renaming the
one of the VirtualChildren. |
protected void
|
recursivePopulate
(
String key,
VirtualChild value)
Actually does the work for the fillBranch method. |
void
|
rename
(
String fullVirtualName,
String newName,
ISystemOperationMonitor archiveOperationMonitor)
Renames the entry fullVirtualName to the new name
newName while still leaving the entry in the same virtual
directory. |
void
|
replace
(
String fullVirtualName,
File file,
String name,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
Same as replace(String fullVirtualName, File file, String name) but you can choose whether
or not you want to leave the zipfile open after return. |
void
|
replace
(
String fullVirtualName,
File file,
String name,
ISystemOperationMonitor archiveOperationMonitor)
Compress the file file and replace the virtual file referred
to by fullVirtualName with the compressed file. |
void
|
replace
(
String fullVirtualName,
InputStream stream,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
Compress the InputStream stream and replace the virtual file
referred to by fullVirtualName with the compressed stream. |
protected void
|
replaceOldZip
(
File outputTempFile)
Replaces the old zip file managed by this SystemZipHandler, with
the zip file referred to by outputTempFile. |
protected
ZipEntry
|
safeGetEntry
(
String name)
Returns the entry corresponding to name from _zipfile. |
SystemSearchLineMatch[]
|
search
(
String fullVirtualName,
SystemSearchStringMatcher matcher,
ISystemOperationMonitor archiveOperationMonitor)
Search for text within a virtual file in this archive. |
protected void
|
updateTreeAfterRename
(
HashMap newOldName,
VirtualChild[] renameList)
Update the virtual file system tree after rename operation. |
protected boolean
|
updateVirtualFSIfNecessary
(
ISystemOperationMonitor archiveOperationMonitor)
If the mod-times of the underlying zip file and the file used to
create the virtualFS are different, update the virtualFS. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
_zipfile
protected
ZipFile _zipfile
_virtualFS
protected
HashMap _virtualFS
_file
protected
File _file
_vfsLastModified
protected long _vfsLastModified
_exists
protected boolean _exists
_mutex
protected
SystemReentrantMutex _mutex
-
Since:
- org.eclipse.rse.services 3.0
SystemZipHandler
public SystemZipHandler(
File file)
throws
IOException
- Creates a new SystemZipHandler and associates it with
file .
-
Parameters:
-
file - The file that this handler will wrapper.
-
Throws:
-
IOException
- If there is an error handling file
buildTree
protected void buildTree()
- Builds the virtual file system tree out of the entries in
the zipfile.
-
-
updateTreeAfterRename
protected void updateTreeAfterRename(
HashMap newOldName,
VirtualChild[] renameList)
- Update the virtual file system tree after rename operation.
-
-
-
Since:
- org.eclipse.rse.services 3.0
fillBranch
protected void fillBranch(
ZipEntry next)
- Populates an entire branch of the tree that comprises the
virtual file system. The parameter is the leaf node, and from
the virtual path of the parameter, we can deduce what the ancestors
of the leaves are, and populate the tree from there.
-
-
-
Parameters:
-
next - The ZipEntry from which the branch will be built.
fillBranchAfterRename
protected void fillBranchAfterRename(
ZipEntry next,
String oldName)
- Populates an entire branch of the tree that comprises the
virtual file system. The parameter is the leaf node, and from
the virtual path of the parameter, we can deduce what the ancestors
of the leaves are, and populate the tree from there.
-
-
-
Parameters:
-
next - The ZipEntry from which the branch will be built. -
Since:
- org.eclipse.rse.services 3.0
recursivePopulate
protected void recursivePopulate(
String key,
VirtualChild value)
- Actually does the work for the fillBranch method. Recursively
inserts key/value pairs into the virtualFS, then uses the key
to get the next parent (moving up one level) and thus recursively
populates one branch.
-
-
populate
protected void populate(
String key,
VirtualChild value)
-
-
-
Since:
- org.eclipse.rse.services 3.0
getVirtualChildrenList
public
VirtualChild[] getVirtualChildrenList(
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Return a flat list of entries in an archive.
-
-
Specified by:
-
getVirtualChildrenList
in interface
ISystemArchiveHandler
-
-
Parameters:
-
archiveOperationMonitor - the operation progress monitor
-
Returns:
- an array containing all the entries in the archive file in a flat
format, where the entries' filenames are prepended by the path to the
entry within the virtual file system. If there are no entries in the
file, returns an array of size 0.
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
getVirtualChildrenList
public
VirtualChild[] getVirtualChildrenList(boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Same as getVirtualChildrenList(), but you can choose whether to leave the
zip file open or closed upon return.
-
-
-
Throws:
-
SystemMessageException
- in case of an error -
Since:
- org.eclipse.rse.services 3.0
getVirtualChildrenList
public
VirtualChild[] getVirtualChildrenList(
String parent,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Return a flat list of entries in an archive, whose full paths begin with
the given parent prefix.
-
-
Specified by:
-
getVirtualChildrenList
in interface
ISystemArchiveHandler
-
-
Parameters:
-
parent - full path of the parent -
archiveOperationMonitor - the operation progress monitor
-
Returns:
- an array containing all the entries in the archive file in a flat
format, whose full paths begin with the String
parent .
Returns an array of length 0 if there are no such entries.
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
getVirtualChildrenList
public
VirtualChild[] getVirtualChildrenList(
String parent,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Same as getVirtualChildrenList(String parent) but you can choose whether
or not you want to leave the zipfile open after return.
-
-
-
Throws:
-
SystemMessageException
- in case of an error -
Since:
- org.eclipse.rse.services 3.0
getVirtualChildren
public
VirtualChild[] getVirtualChildren(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
- Return the children of a specified node in an archive.
-
-
Specified by:
-
getVirtualChildren
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - full virtual path of the parent -
archiveOperationMonitor - the operation progress monitor
-
Returns:
- an array containing the virtual children of the virtual directory
named
fullVirtualName . If fullVirtualName is
"", returns the top level in the virtual file system tree. If there are
no values to return, returns null. -
Since:
- 3.0
getVirtualChildFolders
public
VirtualChild[] getVirtualChildFolders(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
- Return those children of a specified node in an archive, which are
folders.
-
-
Specified by:
-
getVirtualChildFolders
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - full virtual path of the parent -
archiveOperationMonitor - the operation progress monitor
-
Returns:
- an array containing the virtual children of the virtual directory
named
fullVirtualName that are themselves directories. If
fullVirtualName is "", returns the top level of directories
in the virtual file system tree. If there are no values to return,
returns null. -
Since:
- 3.0
getVirtualFile
public
VirtualChild getVirtualFile(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
- Return an archive node specified by a given virtual path.
-
-
Specified by:
-
getVirtualFile
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - full virtual path of the object to retrieve -
archiveOperationMonitor - the operation progress monitor
-
Returns:
- the virtual File or Folder referred to by
fullVirtualName . This method never returns null. In cases
where the VirtualChild does not physically exist in the archive, this
method returns a new VirtualChild object whose exists() method returns
false. -
Since:
- 3.0
exists
public boolean exists(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Check whether a given virtual node exists in an archive.
-
-
Specified by:
-
exists
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - full virtual path of the object -
archiveOperationMonitor - the operation progress monitor
-
Returns:
- Whether or not the virtual file or folder named
fullVirtualName exists in the archive (physically).
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
getArchive
public
File getArchive()
-
Description copied from interface:
ISystemArchiveHandler
- Return the archive that this handler deals with.
-
-
Specified by:
-
getArchive
in interface
ISystemArchiveHandler
-
-
Returns:
- the archive that this handler deals with
getTimeStampFor
public long getTimeStampFor(
String fullVirtualName)
throws
SystemMessageException
-
Description copied from interface:
ISystemArchiveHandler
- Return the timestamp for an archive node.
-
-
Specified by:
-
getTimeStampFor
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - virtual path specifying the node to check
-
Returns:
- the current timestamp (last modified) for the archive entry named
fullVirtualName
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation
getTimeStampFor
public long getTimeStampFor(
String fullVirtualName,
boolean closeZipFile)
throws
SystemMessageException
- Same as getTimeStampFor(String fullVirtualName) but you can choose whether
or not you want to leave the zipfile open after return.
-
-
-
Throws:
-
SystemMessageException
getSizeFor
public long getSizeFor(
String fullVirtualName)
throws
SystemMessageException
-
Description copied from interface:
ISystemArchiveHandler
- Return the size for an archive node.
-
-
Specified by:
-
getSizeFor
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - virtual path specifying the node to check
-
Returns:
- the current size (uncompressed) for the entry in the archive
named
fullVirtualName
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation
getSizeFor
public long getSizeFor(
String fullVirtualName,
boolean closeZipFile)
throws
SystemMessageException
- Same as
getSizeFor(String) but allows to specify whether to
close the zip file or not.
-
-
-
Parameters:
-
fullVirtualName - absolute virtual path to the node to inspect -
closeZipFile - true if the zip file should be closed
-
Returns:
- the uncompressed size of the node requested.
-
Throws:
-
SystemMessageException
-
See Also:
-
ISystemArchiveHandler.getSizeFor(java.lang.String)
extractVirtualFile
public void extractVirtualFile(
String fullVirtualName,
File destination,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Extracts the virtual file named
fullVirtualName from the
archive, placing the results in destination .
-
-
Specified by:
-
extractVirtualFile
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - The full path and name of the virtual file in the
archive. -
destination - The destination file for the extracted virtual file. -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
extractVirtualFile
public void extractVirtualFile(
String fullVirtualName,
File destination,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Extracts the virtual file named
fullVirtualName from the
archive, placing the results in destination . Extracts to the
native encoding, but assumes that the source was archived using
sourceEncoding if isText is true.
-
-
Specified by:
-
extractVirtualFile
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - The full path and name of the virtual file in the
archive. -
destination - The destination file for the extracted virtual file. -
sourceEncoding - The encoding of the file in the archive. -
isText - Whether or not the virtual file is a text file. -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
extractVirtualFile
public void extractVirtualFile(
String fullVirtualName,
File destination,
boolean closeZipFile,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Same as extractVirtualFile(String fullVirtualName, File destination) but you can choose whether
or not you want to leave the zipfile open after return.
-
-
-
Throws:
-
SystemMessageException
-
Since:
- org.eclipse.rse.services 3.0
extractVirtualDirectory
public void extractVirtualDirectory(
String dir,
File destinationParent,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Extracts the directory
dir (and its children) from the
archive and places the results in the directory
destinationParent .
-
-
Specified by:
-
extractVirtualDirectory
in interface
ISystemArchiveHandler
-
-
Parameters:
-
dir - The full name of the virtual directory to extract -
destinationParent - A handle to the directory in which the extracted
directory will be placed as a subdirectory. -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
extractVirtualDirectory
public void extractVirtualDirectory(
String dir,
File destinationParent,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Extracts the directory
dir (and its children) from the
archive and places the results in the directory
destinationParent . Extracts to the native encoding (if
isText ), but assumes that the source was archived using
sourceEncoding .
-
-
Specified by:
-
extractVirtualDirectory
in interface
ISystemArchiveHandler
-
-
Parameters:
-
dir - The full name of the virtual directory to extract -
destinationParent - A handle to the directory in which the extracted
directory will be placed as a subdirectory. -
sourceEncoding - The encoding of the files in the archive. -
isText - Whether or not the files in the directory are text files -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
extractVirtualDirectory
public void extractVirtualDirectory(
String dir,
File destinationParent,
File destination,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Extracts the directory
dir (and its children) from the
archive and places the results in the directory
destinationParent . The results will be named
destination.getName() rather than dir 's name.
-
-
Specified by:
-
extractVirtualDirectory
in interface
ISystemArchiveHandler
-
-
Parameters:
-
dir - The full name of the virtual directory to extract -
destinationParent - A handle to the directory in which the extracted
directory will be placed as a subdirectory. -
destination - A handle to the directory that will be created.
Whatever contents are in that directory will be replaced with what
is extracted from the archive. -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
extractVirtualDirectory
public void extractVirtualDirectory(
String dir,
File destinationParent,
File destination,
String sourceEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Extracts the directory
dir (and its children) from the
archive and places the results in the directory
destinationParent . The results will be named
destination.getName() rather than dir 's name. Extracts to
the native encoding (if isText ), but assumes that the source
was archived using sourceEncoding .
-
-
Specified by:
-
extractVirtualDirectory
in interface
ISystemArchiveHandler
-
-
Parameters:
-
dir - The full name of the virtual directory to extract -
destinationParent - A handle to the directory in which the extracted
directory will be placed as a subdirectory. -
destination - A handle to the directory that will be created.
Whatever contents are in that directory will be replaced with what
is extracted from the archive. -
sourceEncoding - The encoding of the files in the archive. -
isText - Whether or not the files to be extracted in the directory
are all text files -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
createFile
protected void createFile(
File file)
throws
SystemMessageException
- Create an empty file, also creating parent folders if necessary.
-
-
-
Parameters:
-
file - An abstract file handle to create physically.
-
Throws:
-
SystemMessageException
- in case of an error otherwise. -
Since:
- 3.0 throws SystemMessageException
add
public void add(
File file,
String virtualPath,
String name,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Compresses the file
file and adds it to the archive, placing
it in the virtual directory virtualPath . Pass the name as
the parameter name . If the virtual path does not exist in
the archive, create it. If file is a directory, copy it and
its contents into the archive, maintaining the tree structure.
-
-
Specified by:
-
add
in interface
ISystemArchiveHandler
-
-
Parameters:
-
file - the file to be added to the archive -
virtualPath - the destination of the file -
name - the name of the result virtual file -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
add
public void add(
InputStream stream,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Compresses the bytes in the InputStream
stream and adds them
as an entry to the archive, saving them in the encoding specified by
encoding if isText is true, and placing it in
the virtual directory virtualPath . Pass the name as the
parameter name . If the virtual path does not exist in the
archive, create it.
-
-
Specified by:
-
add
in interface
ISystemArchiveHandler
-
-
Parameters:
-
stream - the InputStream to be added as an entry to the archive -
virtualPath - the destination of the stream -
name - the name of the result virtual file -
sourceEncoding - the encoding of the source stream -
targetEncoding - the encoding of the result file -
isText - is the file a text file -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
add
public void add(
File[] files,
String virtualPath,
String[] names,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- A generalization of the add method. Compresses the array of files
files and adds each of them to the archive, placing them in
the virtual directory virtualPath . Pass the names of the
files as the parameter names , where files[i]
has the name names[i] . If the virtual path does not exist in
the archive, create it.
-
-
Specified by:
-
add
in interface
ISystemArchiveHandler
-
-
Parameters:
-
files - the list of files to be added to the archive -
virtualPath - the destination of the file -
names - the names of the result virtual files -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
add
public void add(
File[] files,
String virtualPath,
String[] names,
String[] sourceEncodings,
String[] targetEncodings,
boolean[] isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- A generalization of the add method. Compresses the array of files
files and adds each of them to the archive, placing them in
the virtual directory virtualPath . Save the i'th file in the
i'th encoding (if isText[i] is true) specified by encodings .
Pass the names of the files as the parameter names , where
files[i] has the name names[i] . If the virtual
path does not exist in the archive, create it.
-
-
Specified by:
-
add
in interface
ISystemArchiveHandler
-
-
Parameters:
-
files - the list of files to be added to the archive -
virtualPath - the destination of the files -
names - the names of the result virtual files -
sourceEncodings - the encoding of the source files -
targetEncodings - the encoding of the result files -
isText - file transfer mode (binary or text) of the files -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
add
public void add(
File[] files,
String virtualPath,
String[] names,
String[] sourceEncodings,
String[] targetEncodings,
boolean[] isText,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Same as add(File[] files, String virtualPath, String[] names, String[] encodings) but you can choose whether
or not you want to leave the zipfile open after return.
-
-
-
Throws:
-
SystemMessageException
-
Since:
- org.eclipse.rse.services 3.0
listAllFiles
public static boolean listAllFiles(
File parent,
HashSet found,
ISystemOperationMonitor archiveOperationMonitor)
- Helper method. populates
found with a collapsed list of
all nodes in the subtree of the file system rooted at parent .
-
-
-
Since:
- org.eclipse.rse.services 3.0
recreateZipDeleteEntries
protected boolean recreateZipDeleteEntries(
VirtualChild[] vcList,
ZipOutputStream dest,
HashSet omitChildren,
ISystemOperationMonitor archiveOperationMonitor)
throws
IOException
- Recreates a zip file from a list of virtual children, optionally omitting
a group of children whose names are in the Set omitChildren
-
-
-
Parameters:
-
vcList - The list of virtual children to create the zip from -
dest - The ZipOutputStream representing the zip file where the
children are to be recreated -
omitChildren - The set of names of children to omit when creating
the zipfile. Null or empty set if there are no omissions.
-
Returns:
-
true if the operation is cancelled
-
Throws:
-
IOException
- in case of a file I/O error -
Since:
- org.eclipse.rse.services 3.0
recreateZipRenameEntries
protected boolean recreateZipRenameEntries(
VirtualChild[] vcList,
ZipOutputStream dest,
HashMap names,
ISystemOperationMonitor archiveOperationMonitor)
throws
IOException
- Recreates a zip file from a list of virtual children, but renaming the
one of the VirtualChildren.
-
-
-
Parameters:
-
vcList - The list of virtual children to create the zip from -
dest - The ZipOutputStream representing the zip file where the
children are to be recreated -
names - HashMap maps the full path of a virtual file to the entry in
the archive file
-
Returns:
-
true if the operation has been cancelled
-
Throws:
-
IOException
- in case of an error. -
Since:
- org.eclipse.rse.services 3.0
appendFile
protected
ZipEntry appendFile(
File file,
ZipOutputStream dest,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText)
throws
IOException
- Compresses the contents of
file , adding them to the ZipFile
managed by dest . The file is encoded in the encoding
specified by encoding . A new entry is created in the ZipFile
with virtual path and name of virtualPath and
name respectively.
-
-
-
Returns:
- The ZipEntry that was added to the destination zip file.
-
Throws:
-
IOException
- in case of an error.
appendBytes
protected
ZipEntry appendBytes(
InputStream stream,
ZipOutputStream dest,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText)
throws
IOException
- Compresses the contents of
stream , adding them to the
ZipFile managed by dest . The stream is encoded in the
encoding specified by encoding . A new entry is created in
the ZipFile with virtual path and name of virtualPath and
name respectively.
-
-
-
Returns:
- The ZipEntry that was added to the destination zip file.
-
Throws:
-
IOException
- in case of an error.
replaceOldZip
protected void replaceOldZip(
File outputTempFile)
throws
IOException
- Replaces the old zip file managed by this SystemZipHandler, with
the zip file referred to by outputTempFile.
-
-
-
Throws:
-
IOException
- if outputTempFile cannot be used as a ZipFile.
delete
public boolean delete(
String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Deletes the entry
fullVirtualName from the archive, and
returns whether or not the deletion was successful.
-
-
Specified by:
-
delete
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the path of the file to be deleted -
archiveOperationMonitor - the operation progress monitor
-
Returns:
-
true if the deletion is successful,
false if the file to delete was not found so this was a
successful no-op.
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
delete
public boolean delete(
String fullVirtualName,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Same as delete(String fullVirtualName) but you can choose whether
or not you want to leave the zipfile open after return.
-
-
-
Throws:
-
SystemMessageException
-
Since:
- org.eclipse.rse.services 3.0
delTree
protected void delTree(
VirtualChild vc)
- Deletes all the children of the directory VirtualChild
vc
recursively down to the leaves.
Pre: vc.isDirectory is true
-
-
-
Parameters:
-
vc - The child whose children we are deleting.
replace
public void replace(
String fullVirtualName,
File file,
String name,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Compress the file
file and replace the virtual file referred
to by fullVirtualName with the compressed file. Pass the
name of the file as the parameter name .
-
-
Specified by:
-
replace
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the path of the file to be replaced -
file - the file to be added to the archive -
name - the name of the file -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
replace
public void replace(
String fullVirtualName,
File file,
String name,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Same as replace(String fullVirtualName, File file, String name) but you can choose whether
or not you want to leave the zipfile open after return.
-
-
-
Throws:
-
SystemMessageException
-
Since:
- org.eclipse.rse.services 3.0
replace
public void replace(
String fullVirtualName,
InputStream stream,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Compress the InputStream
stream and replace the virtual file
referred to by fullVirtualName with the compressed stream.
Pass the name of the new entry as the parameter name , the
encoding of the entry as encoding and whether or not the
entry isText or not.
-
-
Specified by:
-
replace
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the path of the file to be replaced -
stream - the InputStream to be added as an entry to the archive -
name - the name of the result virtual file -
sourceEncoding - the encoding of the source stream -
targetEncoding - the encoding of the result file -
isText - is the file a text file -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
fullRename
public void fullRename(
String fullVirtualName,
String newFullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Replaces the full name and path of the entry
fullVirtualName
with the new full name and path newFullVirtualName .
-
-
Specified by:
-
fullRename
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the path of the file to be renamed -
newFullVirtualName - the full path of the virtual file name -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
fullRename
public void fullRename(
String fullVirtualName,
String newFullVirtualName,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Same as fullRename(String fullVirtualName, String newFullVirtualName) but
you can choose whether or not you want to leave the zipfile open after
return.
-
-
-
Throws:
-
SystemMessageException
- in case of an error or user cancellation. -
Since:
- org.eclipse.rse.services 3.0
move
public void move(
String fullVirtualName,
String destinationVirtualPath,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Moves the entry
fullVirtualName to the location specified by
destinationVirtualPath , while leaving the entry with the
same name as before.
-
-
Specified by:
-
move
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the path of the file to be renamed -
destinationVirtualPath - the destination of the file to move to -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
rename
public void rename(
String fullVirtualName,
String newName,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Renames the entry
fullVirtualName to the new name
newName while still leaving the entry in the same virtual
directory. Returns true if and only if the rename was successful.
-
-
Specified by:
-
rename
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the path of the file to be renamed -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
getFiles
public
File[] getFiles(
String[] fullNames,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Extracts and returns the specified list of virtual files from the
archive.
-
-
Specified by:
-
getFiles
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullNames - The list of files to return -
archiveOperationMonitor - the operation progress monitor
-
Returns:
- An array of handles to the extracted files. If fullNames has
length 0 then this method returns an array of length 0.
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
createFolder
public void createFolder(
String name,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Creates a new, empty folder in the archive. If parent folders do not
exist either, creates them.
-
-
Specified by:
-
createFolder
in interface
ISystemArchiveHandler
-
-
Parameters:
-
name - The full name and path of the new folder within
the virtual file system. -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
createFile
public void createFile(
String name,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Creates a new, empty file in the archive. If parent folders do not exist
either, creates them.
-
-
Specified by:
-
createFile
in interface
ISystemArchiveHandler
-
-
Parameters:
-
name - The full name and path of the new file within the
virtual file system. -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
createVirtualObject
protected boolean createVirtualObject(
String name,
boolean closeZipFile,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Creates a new, empty object in the virtual File system, and creates an
empty file or folder in the physical zip file.
-
-
-
Parameters:
-
name - The name of the file or folder to create. The object created
will be a folder if and only if name ends in a "/".
-
Returns:
-
true if the object was created. false
if the creation was a no-op because the object already existed.
-
Throws:
-
SystemMessageException
- in case of an error or cancellation. -
Since:
- org.eclipse.rse.services 3.0
appendEmptyFile
protected
ZipEntry appendEmptyFile(
ZipOutputStream dest,
String name)
throws
IOException
- Works similarly to appendFile, except no actual data is appended
to the zipfile, only an entry is created. Thus, if the file were
to be extracted, it would be of length 0.
-
-
-
Parameters:
-
dest - The destination zip stream to append the entry. -
name - The new, virtual fullname to give the entry.
-
Returns:
- The ZipEntry that was created.
-
Throws:
-
IOException
- If there was an error appending the entry to the stream.
createSafeZipEntry
protected
ZipEntry createSafeZipEntry(
String name)
- A "safe" ZipEntry is one whose virtual path does not begin with a
"/". This seems to cause the least problems for archive utilities,
including this one.
-
-
-
Parameters:
-
name - The virtual name for the new, safe ZipEntry.
-
Returns:
- The ZipEntry that is created.
getStandardName
public
String getStandardName(
VirtualChild vc)
-
Description copied from interface:
ISystemArchiveHandler
- Get the archive-type specific standard name for the VirtualChild
vc . For example, for Zip archives, if vc is a directory,
then the standard name must end with a "/".
-
-
Specified by:
-
getStandardName
in interface
ISystemArchiveHandler
-
-
Parameters:
-
vc - the archive node to use
-
Returns:
- the standard name for the node
openZipFile
protected boolean openZipFile()
throws
IOException
- Opens the zipfile that this handler manages.
-
-
-
Throws:
-
IOException
- in case of an error
closeZipFile
protected boolean closeZipFile()
-
-
updateVirtualFSIfNecessary
protected boolean updateVirtualFSIfNecessary(
ISystemOperationMonitor archiveOperationMonitor)
- If the mod-times of the underlying zip file and the file used to
create the virtualFS are different, update the virtualFS.
-
-
-
Returns:
- whether or not the op was successful.
-
Since:
- org.eclipse.rse.services 3.0
safeGetEntry
protected
ZipEntry safeGetEntry(
String name)
throws
IOException
- Returns the entry corresponding to
name from _zipfile. Never returns
null, but rather, throws an IOException if it cannot find the entry. Tries to retrieve
both name and "/" + name, to accomodate for zipfiles created
in a unix environment. ASSUMES THAT _zipfile IS ALREADY OPEN!
-
-
Throws:
-
IOException
create
public void create()
throws
SystemMessageException
- Turns the archive that this handler represents into a new, empty archive.
(The archive could not exist before, in which case this would be a true
creation).
-
-
Specified by:
-
create
in interface
ISystemArchiveHandler
-
-
Throws:
-
SystemMessageException
- in case of an error -
Since:
- 3.0
search
public
SystemSearchLineMatch[] search(
String fullVirtualName,
SystemSearchStringMatcher matcher,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Search for text within a virtual file in this archive. A good
implementation will not actually extract the file to disk.
-
-
Specified by:
-
search
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the virtual file to search. -
matcher - the pattern matcher to use. -
archiveOperationMonitor - the operation progress monitor
-
Returns:
- an array of match objects corresponding to lines where matches
were found. Returns an empty array if there are no results.
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
exists
public boolean exists()
-
Description copied from interface:
ISystemArchiveHandler
- Check if the archive handler implementation associated with this class
exists.
-
-
Specified by:
-
exists
in interface
ISystemArchiveHandler
-
-
Returns:
- Whether or not the handler exists. Usually false if the archive
is corrupted or unreadable.
getCommentFor
public
String getCommentFor(
String fullVirtualName)
throws
SystemMessageException
-
Description copied from interface:
ISystemArchiveHandler
- Get the user-defined comment for a specific entry in the archive.
-
-
Specified by:
-
getCommentFor
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - The entry who's comment is desired
-
Returns:
- the comment as a String or "" if there is none
-
Throws:
-
SystemMessageException
- in case of an error
getCommentFor
public
String getCommentFor(
String fullVirtualName,
boolean closeZipFile)
throws
SystemMessageException
- same as getCommentFor(String) but you can choose whether or not to leave
the zipfile open after the method is closed
-
-
-
Throws:
-
SystemMessageException
getCompressedSizeFor
public long getCompressedSizeFor(
String fullVirtualName)
throws
SystemMessageException
-
Description copied from interface:
ISystemArchiveHandler
- Get the amount of space taken up by a specific entry in the archive when
it is in compressed form. Compare with getSizeFor(String) which gets the
size of the entry after it is decompressed.
-
-
Specified by:
-
getCompressedSizeFor
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - The entry who's compressed size is desired
-
Returns:
- the compressed size of the specified entry, or 0 if the entry is
not found. If the archive is not a compression type (ie. tar), return
the same as getSizeFor(String).
-
Throws:
-
SystemMessageException
- in case of an error
getCompressedSizeFor
public long getCompressedSizeFor(
String fullVirtualName,
boolean closeZipFile)
throws
SystemMessageException
- same as getCompressedSizeFor(String) but you can choose whether or not to leave
the zipfile open after the method is closed
-
-
-
Throws:
-
SystemMessageException
getCompressionMethodFor
public
String getCompressionMethodFor(
String fullVirtualName)
throws
SystemMessageException
-
Description copied from interface:
ISystemArchiveHandler
- Get the method used to compress a specific entry in the archive.
-
-
Specified by:
-
getCompressionMethodFor
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - The entry who's compression method is desired
-
Returns:
- The compression method of the specified entry, or "" if none.
-
Throws:
-
SystemMessageException
- in case of an error
getCompressionMethodFor
public
String getCompressionMethodFor(
String fullVirtualName,
boolean closeZipFile)
throws
SystemMessageException
- same as getCompressionMethodFor(String) but you can choose whether or not to leave
the zipfile open after the method is closed
-
-
-
Throws:
-
SystemMessageException
getArchiveComment
public
String getArchiveComment()
-
Description copied from interface:
ISystemArchiveHandler
- Get the comment associated with an archive.
-
-
Specified by:
-
getArchiveComment
in interface
ISystemArchiveHandler
-
-
Returns:
- The comment associated with this archive, or "" if there is none.
getClassification
public
String getClassification(
String fullVirtualName)
throws
SystemMessageException
-
Description copied from interface:
ISystemArchiveHandler
- Get the classification for the entry with the given path.
-
-
Specified by:
-
getClassification
in interface
ISystemArchiveHandler
-
-
Parameters:
-
fullVirtualName - the virtual name.
-
Returns:
- the classification.
-
Throws:
-
SystemMessageException
- in case of an error
getClassification
public
String getClassification(
String fullVirtualName,
boolean closeZipFile)
throws
SystemMessageException
- Same as getClassification(String), but you can choose whether to leave the zip file
open after the method is closed.
-
-
-
Throws:
-
SystemMessageException
-
See Also:
-
ISystemArchiveHandler.getClassification(java.lang.String)
add
public void add(
File file,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
ISystemFileTypes registry,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Compresses the file
file and adds it to the archive, saving
it in the encoding specified by encoding if the isText is
true. placing it in the virtual directory virtualPath . Pass
the name as the parameter name . If the virtual path does not
exist in the archive, create it. If file is a directory,
copy it and its contents into the archive, maintaining the tree
structure.
-
-
Specified by:
-
add
in interface
ISystemArchiveHandler
-
-
Parameters:
-
file - the file to be added to the archive -
virtualPath - the destination of the file -
name - the name of the result virtual file -
sourceEncoding - the encoding of the source file -
targetEncoding - the encoding of the result file -
registry - file transfer mode (binary or text) of this file -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
add
public void add(
File file,
String virtualPath,
String name,
String sourceEncoding,
String targetEncoding,
boolean isText,
ISystemOperationMonitor archiveOperationMonitor)
throws
SystemMessageException
- Compresses the file
file and adds it to the archive, saving
it in the encoding specified by encoding if the isText is
true. placing it in the virtual directory virtualPath . Pass
the name as the parameter name . If the virtual path does not
exist in the archive, create it. If file is a directory,
copy it and its contents into the archive, maintaining the tree
structure.
-
-
Specified by:
-
add
in interface
ISystemArchiveHandler
-
-
Parameters:
-
file - the file to be added to the archive -
virtualPath - the destination of the file -
name - the name of the result virtual file -
sourceEncoding - the encoding of the source file -
targetEncoding - the encoding of the result file -
isText - is the file a text file -
archiveOperationMonitor - the operation progress monitor
-
Throws:
-
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellation -
Since:
- 3.0
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|
|