|
RSE Release 3.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.rse.services.clientserver.archiveutils.SystemTarHandler
public class SystemTarHandler
This class deals with tar files.
Field Summary | |
---|---|
protected SystemReentrantMutex |
_mutex
|
protected File |
file
|
protected long |
modTimeDuringCache
|
protected org.eclipse.rse.services.clientserver.archiveutils.SystemTarHandler.VirtualFileSystem |
vfs
|
Constructor Summary | |
---|---|
SystemTarHandler(File file)
Constructor for handler. |
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[] isTexts,
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 encoding,
ISystemFileTypes registry,
ISystemOperationMonitor archiveOperationMonitor)
Compresses the file file and adds it to the archive, saving
it in the encoding specified by encoding if saving in text
mode. |
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 typeRegistery,
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 TarEntry |
appendEmptyFile(TarOutputStream outStream,
String name)
Creates a new tar entry and appends it to the tar output stream with the given name. |
protected void |
appendFile(File file,
TarEntry entry,
TarOutputStream outStream)
Appends a file to a tar output stream, using the given entry that represents the file. |
protected TarEntry |
changeTarEntry(TarEntry entry,
File file,
String virtualPath)
Changes a tar entry according to the file information and given path. |
protected TarEntry |
changeTarEntryName(TarEntry entry,
String newName)
Changes the name of a tar entry. |
void |
create()
Turns the archive that this handler represents into a new, empty archive. |
protected void |
createCache()
Reads the contents of the tar file, and caches the entries. |
void |
createFile(String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Creates a new, empty file in the archive. |
void |
createFolder(String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Creates a new, empty folder in the archive. |
protected boolean |
createTar(VirtualChild[] children,
TarOutputStream outStream,
HashMap renameMap,
ISystemOperationMonitor archiveOperationMonitor)
Creates a tar file from the given virtual child objects, using the given output stream and renaming entries according to hash map entries. |
protected boolean |
createTar(VirtualChild[] children,
TarOutputStream outStream,
HashSet omitChildren,
ISystemOperationMonitor archiveOperationMonitor)
Create a tar file from the given virtual child objects, using the given output stream and omitting the children in the given set. |
protected TarEntry |
createTarEntry(File file,
String virtualPath)
Creates a tar entry for a file with the given virtual path. |
protected boolean |
createVirtualObject(String name,
ISystemOperationMonitor archiveOperationMonitor)
Creates a virtual object that does not already exist in the virtual file system. |
boolean |
delete(String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Deletes the entry fullVirtualName from the archive, and
returns whether or not the deletion was successful. |
protected boolean |
doDelete(String fullVirtualName,
ISystemOperationMonitor archiveOperationMonitor)
Delete a virtual object. |
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 fullVirtualName,
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 fullVirtualName,
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,
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 . |
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 |
getCommentFor(String fullVirtualName)
Get the user-defined comment for a specific entry in the archive. |
long |
getCompressedSizeFor(String fullVirtualName)
Get the amount of space taken up by a specific entry in the archive when it is in compressed form. |
String |
getCompressionMethodFor(String fullVirtualName)
Get the method used to compress a specific entry in the archive. |
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. |
String |
getStandardName(VirtualChild vc)
Get the archive-type specific standard name for the VirtualChild vc . |
protected TarFile |
getTarFile()
Gets a tar file from the underlying file. |
protected TarOutputStream |
getTarOutputStream(File outputFile)
Get the tar output stream for a given file. |
long |
getTimeStampFor(String fullVirtualName)
Return the timestamp for an archive node. |
protected VirtualChild |
getVirtualChild(TarEntry entry)
Returns a virtual child given a tar entry. |
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(ISystemOperationMonitor archiveOperationMonitor)
Return a flat list of entries in an archive. |
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. |
protected void |
init(File file)
Initializes the handler from the given file and does caching. |
void |
listAllFiles(File parent,
List found)
Helper method. |
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. |
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,
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 |
replaceFile(File newFile,
boolean updateCache)
Replaces the old tar file managed by the handler with the given file, and optionally update the cache. |
SystemSearchLineMatch[] |
search(String fullVirtualName,
SystemSearchStringMatcher matcher,
ISystemOperationMonitor archiveOperationMonitor)
Search for text within a virtual file in this archive. |
protected void |
updateCache()
Updates the cache if the tar file has changed since the last time we cached. |
protected void |
updateTree(HashMap newOldNames)
Update the virtual file system tree. |
protected VirtualChild |
updateVirtualChild(TarEntry entry,
VirtualChild child)
update a virtual child given a tar entry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected File file
protected long modTimeDuringCache
protected org.eclipse.rse.services.clientserver.archiveutils.SystemTarHandler.VirtualFileSystem vfs
protected SystemReentrantMutex _mutex
Constructor Detail |
---|
public SystemTarHandler(File file) throws IOException
init
.
file
- the tar file.
IOException
Method Detail |
---|
protected void init(File file) throws IOException
file
- the file to handle
IOException
- in case of error during initialization
(can be thrown by overriding methods)protected void createCache()
protected void updateTree(HashMap newOldNames)
protected TarFile getTarFile()
null
if the tar file does not
exist.protected void updateCache() throws IOException
IOException
public VirtualChild[] getVirtualChildrenList(ISystemOperationMonitor archiveOperationMonitor)
getVirtualChildrenList
in interface ISystemArchiveHandler
archiveOperationMonitor
- the operation progress monitor
public VirtualChild[] getVirtualChildrenList(String parent, ISystemOperationMonitor archiveOperationMonitor)
getVirtualChildrenList
in interface ISystemArchiveHandler
parent
- full path of the parentarchiveOperationMonitor
- the operation progress monitor
parent
.
Returns an array of length 0 if there are no such entries.public VirtualChild[] getVirtualChildren(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor)
getVirtualChildren
in interface ISystemArchiveHandler
fullVirtualName
- full virtual path of the parentarchiveOperationMonitor
- the operation progress monitor
fullVirtualName
. If fullVirtualName
is
"", returns the top level in the virtual file system tree. If there are
no values to return, returns null.public VirtualChild[] getVirtualChildFolders(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor)
getVirtualChildFolders
in interface ISystemArchiveHandler
fullVirtualName
- full virtual path of the parentarchiveOperationMonitor
- the operation progress monitor
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.public VirtualChild getVirtualFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor)
getVirtualFile
in interface ISystemArchiveHandler
fullVirtualName
- full virtual path of the object to retrievearchiveOperationMonitor
- the operation progress monitor
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.public boolean exists(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor)
exists
in interface ISystemArchiveHandler
fullVirtualName
- full virtual path of the objectarchiveOperationMonitor
- the operation progress monitor
fullVirtualName
exists in the archive (physically).public File getArchive()
ISystemArchiveHandler
getArchive
in interface ISystemArchiveHandler
ISystemArchiveHandler.getArchive()
public long getTimeStampFor(String fullVirtualName)
ISystemArchiveHandler
getTimeStampFor
in interface ISystemArchiveHandler
fullVirtualName
- virtual path specifying the node to check
fullVirtualName
public long getSizeFor(String fullVirtualName)
ISystemArchiveHandler
getSizeFor
in interface ISystemArchiveHandler
fullVirtualName
- virtual path specifying the node to check
fullVirtualName
public void extractVirtualFile(String fullVirtualName, File destination, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
fullVirtualName
from the
archive, placing the results in destination
.
extractVirtualFile
in interface ISystemArchiveHandler
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
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void extractVirtualDirectory(String fullVirtualName, File destinationParent, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
dir
(and its children) from the
archive and places the results in the directory
destinationParent
.
extractVirtualDirectory
in interface ISystemArchiveHandler
fullVirtualName
- The full name of the virtual directory to extractdestinationParent
- A handle to the directory in which the extracted
directory will be placed as a subdirectory.archiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void extractVirtualDirectory(String fullVirtualName, File destinationParent, File destination, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
extractVirtualDirectory
in interface ISystemArchiveHandler
fullVirtualName
- The full name of the virtual directory to extractdestinationParent
- 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
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void add(File file, String virtualPath, String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
add
in interface ISystemArchiveHandler
file
- the file to be added to the archivevirtualPath
- the destination of the filename
- the name of the result virtual filearchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void listAllFiles(File parent, List found)
found
with a collapsed
list of all nodes in the subtree of the file system rooted at
parent
.
public void add(File[] files, String virtualPath, String[] names, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
add
in interface ISystemArchiveHandler
files
- the list of files to be added to the archivevirtualPath
- the destination of the filenames
- the names of the result virtual filesarchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationprotected boolean createTar(VirtualChild[] children, TarOutputStream outStream, HashSet omitChildren, ISystemOperationMonitor archiveOperationMonitor) throws IOException
children
- an array of virtual children from which to create a tar
file.outStream
- the tar output stream to use.omitChildren
- the set of names for children that should be omitted
from the given array of virtual children.archiveOperationMonitor
- the operation progress monitor
true
if the operation completes successfully, or
false
if it has been cancelled.
IOException
- if an I/O exception occurs.protected void appendFile(File file, TarEntry entry, TarOutputStream outStream) throws IOException
file
- the file to be appended to the tar output stream.entry
- the entry which represents the file.outStream
- the tar output stream.
IOException
- if an I/O error occurs.protected TarEntry createTarEntry(File file, String virtualPath)
file
- the file for which to create a tar entry.virtualPath
- the virtual path for the entry.
protected TarEntry changeTarEntry(TarEntry entry, File file, String virtualPath)
entry
- the entry that needs to be changed.file
- the file for which the tar entry is being changed.virtualPath
- the virtual path for the entry.
protected VirtualChild getVirtualChild(TarEntry entry)
entry
- a tar entry.
protected VirtualChild updateVirtualChild(TarEntry entry, VirtualChild child)
entry
- a tar entry.
protected void replaceFile(File newFile, boolean updateCache) throws IOException
newFile
- the new tar file.updateCache
- true
to update the cache, false
otherwise.
Only specify false
if the cache has already been updated to reflect the
contents of this new file.
IOException
- if an I/O problem occurs.public void replace(String fullVirtualName, File file, String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
file
and replace the virtual file referred
to by fullVirtualName
with the compressed file. Pass the
name of the file as the parameter name
.
replace
in interface ISystemArchiveHandler
fullVirtualName
- the path of the file to be replacedfile
- the file to be added to the archivename
- the name of the filearchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic boolean delete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
fullVirtualName
from the archive, and
returns whether or not the deletion was successful.
delete
in interface ISystemArchiveHandler
fullVirtualName
- the path of the file to be deletedarchiveOperationMonitor
- the operation progress monitor
true
if the deletion is successful,
false
if the file to delete was not found so this was a
successful no-op.
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationprotected boolean doDelete(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
fullVirtualName
- virtual path identifying the objectarchiveOperationMonitor
- the operation progress monitor
true
if successful, false
if the entry
to delete did not exist (so this was a successful no-op).
SystemMessageException
- in case of an errorpublic void rename(String fullVirtualName, String newName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
rename
in interface ISystemArchiveHandler
fullVirtualName
- the path of the file to be renamedarchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void move(String fullVirtualName, String destinationVirtualPath, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
fullVirtualName
to the location specified by
destinationVirtualPath
, while leaving the entry with the
same name as before.
move
in interface ISystemArchiveHandler
fullVirtualName
- the path of the file to be renameddestinationVirtualPath
- the destination of the file to move toarchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void fullRename(String fullVirtualName, String newFullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
fullVirtualName
with the new full name and path newFullVirtualName
.
fullRename
in interface ISystemArchiveHandler
fullVirtualName
- the path of the file to be renamednewFullVirtualName
- the full path of the virtual file namearchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationprotected boolean createTar(VirtualChild[] children, TarOutputStream outStream, HashMap renameMap, ISystemOperationMonitor archiveOperationMonitor) throws IOException
children
- an array of virtual children from which to create a tar
file.outStream
- the tar output stream to use.renameMap
- a map containing associations between old names and new
names. Old names are the keys in the map, and the values are the new
names.archiveOperationMonitor
- the operation progress monitor
true
if the operation completes successfully, or
false
if it is cancelled by the user.
IOException
- if an I/O exception occurs.protected TarEntry changeTarEntryName(TarEntry entry, String newName)
entry
- the entry for which the name has to be changed.newName
- the new name for the entry.
public File[] getFiles(String[] fullNames, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
getFiles
in interface ISystemArchiveHandler
fullNames
- The list of files to returnarchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void createFolder(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
createFolder
in interface ISystemArchiveHandler
fullVirtualName
- The full name and path of the new folder within
the virtual file system.archiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void createFile(String fullVirtualName, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
createFile
in interface ISystemArchiveHandler
fullVirtualName
- The full name and path of the new file within the
virtual file system.archiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationprotected boolean createVirtualObject(String name, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
name
- the name of the virtual object.archiveOperationMonitor
- the operation progress monitor
true
if the object was created successfully,
false
if the object already exists such that this is a
successful no-op, or if the operation is cancelled by the user.
SystemMessageException
- in case of an error.protected TarEntry appendEmptyFile(TarOutputStream outStream, String name) throws IOException
outStream
- the tar output stream.name
- the name of the new tar entry.
IOException
- if an I/O error occurs.public String getStandardName(VirtualChild vc)
ISystemArchiveHandler
vc
. For example, for Zip archives, if vc is a directory,
then the standard name must end with a "/".
getStandardName
in interface ISystemArchiveHandler
vc
- the archive node to use
public void create() throws SystemMessageException
create
in interface ISystemArchiveHandler
SystemMessageException
- in case of an errorpublic SystemSearchLineMatch[] search(String fullVirtualName, SystemSearchStringMatcher matcher, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
search
in interface ISystemArchiveHandler
fullVirtualName
- the virtual file to search.matcher
- the pattern matcher to use.archiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic boolean exists()
ISystemArchiveHandler
exists
in interface ISystemArchiveHandler
public String getCommentFor(String fullVirtualName)
ISystemArchiveHandler
getCommentFor
in interface ISystemArchiveHandler
fullVirtualName
- The entry who's comment is desired
public long getCompressedSizeFor(String fullVirtualName)
ISystemArchiveHandler
getCompressedSizeFor
in interface ISystemArchiveHandler
fullVirtualName
- The entry who's compressed size is desired
public String getCompressionMethodFor(String fullVirtualName)
ISystemArchiveHandler
getCompressionMethodFor
in interface ISystemArchiveHandler
fullVirtualName
- The entry who's compression method is desired
public String getArchiveComment()
ISystemArchiveHandler
getArchiveComment
in interface ISystemArchiveHandler
public void add(File file, String virtualPath, String name, String encoding, ISystemFileTypes registry, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
file
and adds it to the archive, saving
it in the encoding specified by encoding
if saving in text
mode. Places the file 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.
file
- the file to be added to the archivevirtualPath
- the destination of the filename
- the name of the result virtual fileencoding
- the file encoding to useregistry
- the file type to use (text or binary)archiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an errorpublic void add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
add
in interface ISystemArchiveHandler
file
- the file to be added to the archivevirtualPath
- the destination of the filename
- the name of the result virtual filesourceEncoding
- the encoding of the source filetargetEncoding
- the encoding of the result fileisText
- is the file a text filearchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void add(File[] files, String virtualPath, String[] names, String[] sourceEncodings, String[] targetEncodings, boolean[] isTexts, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
add
in interface ISystemArchiveHandler
files
- the list of files to be added to the archivevirtualPath
- the destination of the filesnames
- the names of the result virtual filessourceEncodings
- the encoding of the source filestargetEncodings
- the encoding of the result filesisTexts
- file transfer mode (binary or text) of the filesarchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void extractVirtualDirectory(String dir, File destinationParent, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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
.
extractVirtualDirectory
in interface ISystemArchiveHandler
dir
- The full name of the virtual directory to extractdestinationParent
- 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 filesarchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void extractVirtualDirectory(String dir, File destinationParent, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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
.
extractVirtualDirectory
in interface ISystemArchiveHandler
dir
- The full name of the virtual directory to extractdestinationParent
- 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 filesarchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void extractVirtualFile(String fullVirtualName, File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
extractVirtualFile
in interface ISystemArchiveHandler
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
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic String getClassification(String fullVirtualName) throws SystemMessageException
ISystemArchiveHandler
getClassification
in interface ISystemArchiveHandler
fullVirtualName
- the virtual name.
SystemMessageException
- in case of an errorpublic void add(InputStream stream, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
add
in interface ISystemArchiveHandler
stream
- the InputStream to be added as an entry to the archivevirtualPath
- the destination of the streamname
- the name of the result virtual filesourceEncoding
- the encoding of the source streamtargetEncoding
- the encoding of the result fileisText
- is the file a text filearchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void add(File file, String virtualPath, String name, String sourceEncoding, String targetEncoding, ISystemFileTypes typeRegistery, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
add
in interface ISystemArchiveHandler
file
- the file to be added to the archivevirtualPath
- the destination of the filename
- the name of the result virtual filesourceEncoding
- the encoding of the source filetargetEncoding
- the encoding of the result filetypeRegistery
- file transfer mode (binary or text) of this filearchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationpublic void replace(String fullVirtualName, InputStream stream, String name, String sourceEncoding, String targetEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor) throws SystemMessageException
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.
replace
in interface ISystemArchiveHandler
fullVirtualName
- the path of the file to be replacedstream
- the InputStream to be added as an entry to the archivename
- the name of the result virtual filesourceEncoding
- the encoding of the source streamtargetEncoding
- the encoding of the result fileisText
- is the file a text filearchiveOperationMonitor
- the operation progress monitor
SystemMessageException
- in case of an error,
or SystemOperationCancelledException in case of user cancellationprotected TarOutputStream getTarOutputStream(File outputFile) throws FileNotFoundException
outputFile
- the output file to create stream
FileNotFoundException
- when the output file doesn't exist
|
RSE Release 3.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |