|
TrueZIP 6.8.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.io.InputArchiveMetaData
public final class InputArchiveMetaData
This class is not intended for public use!
It's only public in order to implement
ArchiveDrivers.
Annotates an InputArchive with the methods required for safe
reading of archive entries.
As an implication of this, it's also responsible for the synchronization
of the streams between multiple threads.
| Nested Class Summary | |
|---|---|
private class |
InputArchiveMetaData.EntryInputStream
An InputStream to read the entry data from an
InputArchive. |
| Field Summary | |
|---|---|
private Archive |
archive
The archive which uses this instance. |
private static String |
CLASS_NAME
|
private InputArchive |
inArchive
|
private static Logger |
logger
|
private boolean |
stopped
|
private Map |
streams
The pool of all open entry streams. |
| Constructor Summary | |
|---|---|
InputArchiveMetaData(Archive archive,
InputArchive inArchive)
Creates a new instance of InputArchiveMetaData
and sets itself as the meta data for the given input archive. |
|
| Method Summary | |
|---|---|
(package private) ArchiveException |
closeAllInputStreams(ArchiveException exceptionChain)
Closes and disconnects all entry streams for the archive containing this metadata object. |
(package private) InputStream |
createInputStream(ArchiveEntry entry,
ArchiveEntry dstEntry)
|
private int |
threadStreams()
Returns the number of streams opened by the current thread. |
(package private) int |
waitAllInputStreamsByOtherThreads(long timeout)
Waits until all entry streams which have been opened (and not yet closed) by all other threads are closed or a timeout occurs. |
| 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 final Archive archive
Detail: While this is really required for input streams for archives which are unmodified, it's actually not required for output streams, since the archive file system is touched for these streams anyway, which in turn schedules the archive controller for the next update, which in turn prevents it from being garbage collected. However, it's provided for symmetry between input archive meta data and output archive meta data.
private final InputArchive inArchive
private final Map streams
File.isLenient() is true, then the map is actually
instantiated as a WeakHashMap. Otherwise, it's a HashMap.
The weak hash map allows the garbage collector to pick up an entry
stream if there are no more references to it.
This reduces the likeliness of an ArchiveBusyWarningException
in case a sloppy client application has forgot to close a stream before
calling File.umount() or File.update().
private volatile boolean stopped
| Constructor Detail |
|---|
InputArchiveMetaData(Archive archive,
InputArchive inArchive)
InputArchiveMetaData
and sets itself as the meta data for the given input archive.
| Method Detail |
|---|
InputStream createInputStream(ArchiveEntry entry,
ArchiveEntry dstEntry)
throws IOException
IOExceptionint waitAllInputStreamsByOtherThreads(long timeout)
java.util.logging and
this method returns.
Unless otherwise prevented, another thread could immediately open another stream upon return of this method. So there is actually no guarantee that really all streams are closed upon return of this method - use carefully!
private int threadStreams()
ArchiveException closeAllInputStreams(ArchiveException exceptionChain)
IOException, with the exception of
their close() method.
|
TrueZIP 6.8.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||