TrueZIP Kernel 7.0-rc1

de.schlichtherle.truezip.fs.archive
Class FsReadOnlyArchiveFileSystem<E extends FsArchiveEntry>

java.lang.Object
  extended by de.schlichtherle.truezip.fs.archive.FsArchiveFileSystem<E>
      extended by de.schlichtherle.truezip.fs.archive.FsReadOnlyArchiveFileSystem<E>
Type Parameters:
E - The type of the archive entries.
All Implemented Interfaces:
EntryContainer<FsArchiveFileSystemEntry<E>>, Iterable<FsArchiveFileSystemEntry<E>>

@NotThreadSafe
final class FsReadOnlyArchiveFileSystem<E extends FsArchiveEntry>
extends FsArchiveFileSystem<E>

A read-only archive file system.

All modifying methods throw a FsReadOnlyArchiveFileSystemException.

Author:
Christian Schlichtherle

Constructor Summary
FsReadOnlyArchiveFileSystem(EntryContainer<E> archive, EntryFactory<E> factory, Entry rootTemplate)
           
 
Method Summary
 boolean isReadOnly()
          The implementation in this class returns true.
 boolean isTouched()
          Returns true if and only if this archive file system has been modified since its time of creation.
 FsArchiveFileSystemOperation<E> mknod(FsEntryName name, Entry.Type type, BitField<FsOutputOption> options, Entry template)
          Begins a transaction to create or replace and finally link a chain of one or more archive entries for the given path into this archive file system.
 boolean setTime(FsEntryName path, BitField<Entry.Access> types, long value)
           
 void unlink(FsEntryName path)
          If this method returns, the file system entry identified by the given path has been successfully deleted from this archive file system.
 
Methods inherited from class de.schlichtherle.truezip.fs.archive.FsArchiveFileSystem
addArchiveFileSystemTouchListener, copy, getArchiveFileSystemTouchListeners, getEntry, getEntry, getSize, isWritable, iterator, newArchiveFileSystem, newArchiveFileSystem, removeArchiveFileSystemTouchListener, setReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FsReadOnlyArchiveFileSystem

FsReadOnlyArchiveFileSystem(@NonNull
                            EntryContainer<E> archive,
                            @NonNull
                            EntryFactory<E> factory,
                            @CheckForNull
                            Entry rootTemplate)
Method Detail

isReadOnly

public boolean isReadOnly()
The implementation in this class returns true.

Overrides:
isReadOnly in class FsArchiveFileSystem<E extends FsArchiveEntry>

isTouched

public boolean isTouched()
Description copied from class: FsArchiveFileSystem
Returns true if and only if this archive file system has been modified since its time of creation.

Overrides:
isTouched in class FsArchiveFileSystem<E extends FsArchiveEntry>

mknod

@NonNull
public FsArchiveFileSystemOperation<E> mknod(@NonNull
                                                     FsEntryName name,
                                                     @NonNull
                                                     Entry.Type type,
                                                     @NonNull
                                                     BitField<FsOutputOption> options,
                                                     @CheckForNull
                                                     Entry template)
                                                             throws FsArchiveFileSystemException
Description copied from class: FsArchiveFileSystem
Begins a transaction to create or replace and finally link a chain of one or more archive entries for the given path into this archive file system.

To commit the transaction, you need to call FsArchiveFileSystemOperation.run() on the returned object, which will mark this archive file system as touched and set the last modification time of the created and linked archive file system entries to the system's current time at the moment of the call to this method.

Overrides:
mknod in class FsArchiveFileSystem<E extends FsArchiveEntry>
Parameters:
name - an entry name.
type - an entry type.
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 archive 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.
Returns:
A new archive file system operation on a chain of one or more archive file system entries for the given path name which will be linked into this archive file system upon a call to its FsArchiveFileSystemOperation.run() method.
Throws:
FsArchiveFileSystemException - If one of the following is true:
  • The file system is read only.
  • name contains characters which are not supported by the file system.
  • TODO: type is not FILE or DIRECTORY.
  • The entry already exists and either the option FsOutputOption.EXCLUSIVE is set or the entry is a directory.
  • The entry exists as a different type.
  • A parent entry exists but is not a directory.
  • A parent entry is missing and createParents is false.

unlink

public void unlink(FsEntryName path)
            throws FsArchiveFileSystemException
Description copied from class: FsArchiveFileSystem
If this method returns, the file system entry identified by the given path has been successfully deleted from this archive file system. If the file system entry is a directory, it must be empty for successful deletion.

Overrides:
unlink in class FsArchiveFileSystem<E extends FsArchiveEntry>
Throws:
FsArchiveFileSystemException - If the operation fails for some other reason.

setTime

public boolean setTime(FsEntryName path,
                       BitField<Entry.Access> types,
                       long value)
                throws FsArchiveFileSystemException
Overrides:
setTime in class FsArchiveFileSystem<E extends FsArchiveEntry>
Throws:
FsArchiveFileSystemException

TrueZIP Kernel 7.0-rc1

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.