|
TrueZIP 6.8.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.io.ArchiveControllers
final class ArchiveControllers
Provides static utility methods for ArchiveControllers.
| Nested Class Summary | |
|---|---|
private static class |
ArchiveControllers.ControllerEnumeration
|
private static class |
ArchiveControllers.LiveArchiveStatistics
|
(package private) static class |
ArchiveControllers.ShutdownHook
TrueZIP's singleton shutdown hook for the JVM. |
| Field Summary | |
|---|---|
private static String |
CLASS_NAME
|
private static Map |
controllers
The map of all archive controllers. |
private static Logger |
logger
|
private static Comparator |
REVERSE_CONTROLLERS
|
| Constructor Summary | |
|---|---|
private |
ArchiveControllers()
This class cannot get instantiated. |
| Method Summary | |
|---|---|
(package private) static ArchiveController |
get(File file)
Factory method returning an ArchiveController object for the
given archive file. |
(package private) static ArchiveStatistics |
getLiveArchiveStatistics()
|
(package private) static void |
set(File target,
Object controller)
Associates the given archive controller to the target file. |
(package private) static void |
umount(String prefix,
boolean waitInputStreams,
boolean closeInputStreams,
boolean waitOutputStreams,
boolean closeOutputStreams,
boolean umount)
Updates all archive files in the real file system which's canonical path name start with prefix with the contents of their
virtual file system, resets all cached state and deletes all temporary
files. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String CLASS_NAME
private static final Logger logger
private static final Map controllers
File instances and the values
are either ArchiveControllers or WeakReferences
to ArchiveControllers.
All access to this map must be externally synchronized!
private static final Comparator REVERSE_CONTROLLERS
| Constructor Detail |
|---|
private ArchiveControllers()
| Method Detail |
|---|
static ArchiveController get(File file)
ArchiveController object for the
given archive file.
Note:
file nor the enclosing archive file(s)
need to actually exist for this to return a valid ArchiveController.
Just the parent directories of file need to look like either
an ordinary directory or an archive file, e.g. their lowercase
representation needs to have a .zip or .jar ending.
static final void set(File target,
Object controller)
target - The target file. This must not be null or
an instance of the File class in this package!controller - An ArchiveController or a
WeakReference to an archive controller.
static void umount(String prefix,
boolean waitInputStreams,
boolean closeInputStreams,
boolean waitOutputStreams,
boolean closeOutputStreams,
boolean umount)
throws ArchiveException
prefix with the contents of their
virtual file system, resets all cached state and deletes all temporary
files.
This method is thread safe.
prefix - The prefix of the canonical path name of the archive files
which shall get updated - null is not allowed!
If the canonical pathname of an archive file does not start with
this string, then it is not updated.waitInputStreams - Suppose any other thread has still one or more
archive entry input streams open.
Then if and only if this parameter is true, this
method will wait until all other threads have closed their
archive entry input streams.
Archive entry input streams opened (and not yet closed) by the
current thread are always ignored.
If the current thread gets interrupted while waiting, it will
stop waiting and proceed normally as if this parameter were
false.
Be careful with this parameter value: If a stream has not been
closed because the client application does not always properly
close its streams, even on an IOException (which is a
typical bug in many Java applications), then this method may
not return until the current thread gets interrupted!closeInputStreams - Suppose there are any open input streams
for any archive entries because the application has forgot to
close all FileInputStream objects or another thread is
still busy doing I/O on an archive.
Then if this parameter is true, an update is forced
and an ArchiveBusyWarningException is finally thrown to
indicate that any subsequent operations on these streams
will fail with an ArchiveEntryStreamClosedException
because they have been forced to close.
This may also be used to recover an application from a
FileBusyException thrown by a constructor of
FileInputStream or FileOutputStream.
If this parameter is false, the respective archive
file is not updated and an ArchiveBusyException
is thrown to indicate that the application must close all entry
input streams first.waitOutputStreams - Similar to waitInputStreams,
but applies to archive entry output streams instead.closeOutputStreams - Similar to closeInputStreams,
but applies to archive entry output streams instead.
If this parameter is true, then
closeInputStreams must be true, too.
Otherwise, an IllegalArgumentException is thrown.umount - If true, all temporary files get deleted, too.
Thereafter, the archive controller will behave as if it has just
been created and any subsequent operations on its entries will
remount the virtual file system from the archive file again.
Use this to allow subsequent changes to the archive files
by other processes or via the java.io.File* classes
before this package is used for read or write access to
these archive files again.
ArchiveBusyWarningExcepion - If a archive file has been updated
while the application is using any open streams to access it
concurrently.
These streams have been forced to close and the entries of
output streams may contain only partial data.
ArchiveWarningException - If only warning conditions occur
throughout the course of this method which imply that the
respective archive file has been updated with
constraints, such as a failure to set the last modification
time of the archive file to the last modification time of its
virtual root directory.
ArchiveBusyException - If an archive file could not get updated
because the application is using an open stream.
No data is lost and the archive file can still get updated by
calling this method again.
ArchiveException - If any error conditions occur throughout the
course of this method which imply loss of data.
This usually means that at least one of the archive files
has been created externally and was corrupted or it cannot
get updated because the file system of the temp file or target
file folder is full.
NullPointerException - If prefix is null.
IllegalArgumentException - If closeInputStreams is
false and closeOutputStreams is
true.static final ArchiveStatistics getLiveArchiveStatistics()
|
TrueZIP 6.8.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||