|
TrueZIP Kernel 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.fs.FsController<FsConcurrentModel>
de.schlichtherle.truezip.fs.archive.FsArchiveController<E>
E - The type of the archive entries.@NotThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public abstract class FsArchiveController<E extends FsArchiveEntry>
An abstract archive controller which is the super class for any archive controller, providing all the essential services required for accessing an archive file. It encapsulates all the code which is not depending on a particular archive update strategy and the corresponding state of the controller.
Each instance of this class manages an archive file - the target file - in order to allow random access to it as if it were a regular directory in its parent file system.
Note that in general all of the methods in this class are reentrant on exceptions. This is important because client applications may repeatedly call them. Of course, depending on the calling context, some or all of the archive file's data may be lost in this case.
| Nested Class Summary | |
|---|---|
private class |
FsArchiveController.Input
|
private class |
FsArchiveController.Output
|
private static class |
FsArchiveController.ProxyEntry
|
| Field Summary | |
|---|---|
private static BitField<FsOutputOption> |
AUTO_MOUNT_OPTIONS
|
private static Logger |
logger
|
private FsConcurrentModel |
model
|
private static BitField<FsSyncOption> |
UNLINK_SYNC_OPTIONS
|
| Constructor Summary | |
|---|---|
protected |
FsArchiveController(FsConcurrentModel model)
Constructs a new basic archive controller. |
| Method Summary | |
|---|---|
(package private) FsArchiveFileSystem<E> |
autoMount()
|
(package private) abstract FsArchiveFileSystem<E> |
autoMount(boolean autoCreate,
BitField<FsOutputOption> options)
Returns the (virtual) archive file system mounted from the target archive file. |
(package private) abstract boolean |
autoSync(FsEntryName name,
Entry.Access intention)
Synchronizes the archive file only if the archive file has new data for the file system entry with the given path path. |
FsEntry |
getEntry(FsEntryName name)
|
InputSocket<?> |
getInputSocket(FsEntryName name,
BitField<FsInputOption> options)
Returns an input socket for reading the contents of the entry addressed by the given name from the file system. |
(package private) abstract InputSocket<?> |
getInputSocket(String name)
|
FsConcurrentModel |
getModel()
Returns the file system model. |
(package private) abstract OutputSocket<?> |
getOutputSocket(E entry)
|
OutputSocket<?> |
getOutputSocket(FsEntryName name,
BitField<FsOutputOption> options,
Entry template)
Returns an output socket for writing the contents of the entry addressed by the given name to the file system. |
boolean |
isReadable(FsEntryName name)
|
boolean |
isReadOnly()
|
boolean |
isWritable(FsEntryName name)
|
void |
mknod(FsEntryName name,
Entry.Type type,
BitField<FsOutputOption> options,
Entry template)
Creates or replaces and finally links a chain of one or more entries for the given entry name into the file system. |
void |
setReadOnly(FsEntryName name)
|
boolean |
setTime(FsEntryName name,
BitField<Entry.Access> types,
long value)
|
void |
unlink(FsEntryName name)
|
| Methods inherited from class de.schlichtherle.truezip.fs.FsController |
|---|
equals, getClosedIcon, getOpenIcon, getParent, hashCode, sync, sync, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final Logger logger
private static final BitField<FsOutputOption> AUTO_MOUNT_OPTIONS
private static final BitField<FsSyncOption> UNLINK_SYNC_OPTIONS
private final FsConcurrentModel model
| Constructor Detail |
|---|
protected FsArchiveController(FsConcurrentModel model)
model - the non-null archive model.| Method Detail |
|---|
public final FsConcurrentModel getModel()
FsController
getModel in class FsController<FsConcurrentModel>
final FsArchiveFileSystem<E> autoMount()
throws IOException
IOException
abstract FsArchiveFileSystem<E> autoMount(boolean autoCreate,
BitField<FsOutputOption> options)
throws IOException
Warning: Either the read or the write lock of this controller must be acquired while this method is called! If only a read lock is acquired, but a write lock is required, this method will temporarily release all locks, so any preconditions must be checked again upon return to protect against concurrent modifications!
autoCreate - If the archive file does not exist and this is
true, a new file system with only a (virtual) root
directory is created with its last modification time set to the
system's current time.
null is never returned.
FsFalsePositiveException
IOException
public final boolean isReadOnly()
throws IOException
isReadOnly in class FsController<FsConcurrentModel>IOException
public final FsEntry getEntry(FsEntryName name)
throws IOException
getEntry in class FsController<FsConcurrentModel>IOException
public final boolean isReadable(FsEntryName name)
throws IOException
isReadable in class FsController<FsConcurrentModel>IOException
public final boolean isWritable(FsEntryName name)
throws IOException
isWritable in class FsController<FsConcurrentModel>IOException
public final void setReadOnly(FsEntryName name)
throws IOException
setReadOnly in class FsController<FsConcurrentModel>IOException
public final boolean setTime(FsEntryName name,
BitField<Entry.Access> types,
long value)
throws IOException
setTime in class FsController<FsConcurrentModel>IOException
public final InputSocket<?> getInputSocket(FsEntryName name,
BitField<FsInputOption> options)
FsController
getInputSocket in class FsController<FsConcurrentModel>name - a file system entry name.
InputSocket.
abstract InputSocket<?> getInputSocket(String name)
throws IOException
IOException
public final OutputSocket<?> getOutputSocket(FsEntryName name,
BitField<FsOutputOption> options,
@CheckForNull
Entry template)
FsControllertemplate is not null, then the output entry shall
have as many of its properties copied as reasonable, e.g. the last
modification time.
getOutputSocket in class FsController<FsConcurrentModel>name - a file system entry name.template - a nullable template for the properties of the output
entry.
OutputSocket.
abstract OutputSocket<?> getOutputSocket(E entry)
throws IOException
IOException
public final void mknod(FsEntryName name,
Entry.Type type,
BitField<FsOutputOption> options,
@CheckForNull
Entry template)
throws IOException
FsControllername into the file system.
mknod in class FsController<FsConcurrentModel>name - the file system entry name.type - the file system entry type.options - the file system output options.
If CREATE_PARENTS is set, any missing parent directories
will be created and linked into this file system with its last
modification time set to the system's current time.template - if not null, then the file system entry
at the end of the chain shall inherit as much properties from
this entry as possible - with the exception of its name and type.
IOException - for some other I/O related reason, including but
not exclusively upon one or more of the following conditions:
name contains characters which are not
supported by the file system.
FsOutputOption.EXCLUSIVE is set or the entry is a
directory.
createParents is
false.
public void unlink(FsEntryName name)
throws IOException
unlink in class FsController<FsConcurrentModel>IOException
abstract boolean autoSync(FsEntryName name,
@CheckForNull
Entry.Access intention)
throws FsSyncException,
FsException
Warning: As a side effect, all data structures may get reset (filesystem, entries, streams, etc.)! This method may require synchronization on the write lock!
name - the non-null entry name.intention - the intended operation on the entry. If null,
a pure file system operation with no I/O is intended.
IOException - if any exceptional condition occurs
throughout the synchronization of the target archive file.
FsNotWriteLockedException
FsSyncException
FsExceptionFsController.sync(de.schlichtherle.truezip.util.BitField)
|
TrueZIP Kernel 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||