public final class TFileSystem extends java.nio.file.FileSystem
| Modifier and Type | Field and Description |
|---|---|
private FsController<?> |
controller |
private static Map<FsMountPoint,TFileSystem> |
fileSystems |
private static FsManager |
manager
The file system manager to use within this package.
|
private FsMountPoint |
mountPoint |
private TFileSystemProvider |
provider |
| Modifier | Constructor and Description |
|---|---|
private |
TFileSystem(FsMountPoint mountPoint,
TFileSystemProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Commits all unsynchronized changes to the contents of this federated
file system (i.e. prospective archive files)
and all its member federated file systems to their respective parent
system, releases the associated resources (i.e. target archive files)
for access by third parties (e.g. other processes), cleans up any
temporary allocated resources (e.g. temporary files) and purges any
cached data.
|
(package private) void |
createDirectory(TPath path,
java.nio.file.attribute.FileAttribute<?>... attrs) |
(package private) void |
delete(TPath path) |
(package private) static TFileSystem |
get(TPath path) |
(package private) FsController<?> |
getController(FsCompositeDriver driver) |
(package private) FsEntry |
getEntry(TPath path) |
Iterable<java.nio.file.FileStore> |
getFileStores() |
(package private) InputSocket<?> |
getInputSocket(TPath path,
BitField<FsInputOption> options) |
FsMountPoint |
getMountPoint() |
(package private) OutputSocket<?> |
getOutputSocket(TPath path,
BitField<FsOutputOption> options,
Entry template) |
TPath |
getPath(String first,
String... more) |
java.nio.file.PathMatcher |
getPathMatcher(String syntaxAndPattern) |
Iterable<java.nio.file.Path> |
getRootDirectories() |
String |
getSeparator() |
java.nio.file.attribute.UserPrincipalLookupService |
getUserPrincipalLookupService() |
static boolean |
isLenient()
Returns the value of the class property
lenient. |
boolean |
isOpen() |
boolean |
isReadOnly() |
(package private) java.nio.file.DirectoryStream<java.nio.file.Path> |
newDirectoryStream(TPath path,
java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter) |
java.nio.file.WatchService |
newWatchService() |
TFileSystemProvider |
provider() |
static void |
setLenient(boolean lenient)
Sets the value of the class property
lenient. |
Set<String> |
supportedFileAttributeViews() |
void |
sync(BitField<FsSyncOption> options)
Commits all unsynchronized changes to the contents of this federated
file system (i.e. prospective archive file)
and all its member federated file systems to their respective parent
file system, releases the associated resources (i.e. target archive
files) for access by third parties (e.g. other processes), cleans up any
temporary allocated resources (e.g. temporary files) and purges any
cached data.
|
private static final FsManager manager
private static final Map<FsMountPoint,TFileSystem> fileSystems
private final FsMountPoint mountPoint
private final TFileSystemProvider provider
private volatile FsController<?> controller
private TFileSystem(FsMountPoint mountPoint, TFileSystemProvider provider)
static TFileSystem get(TPath path)
public static boolean isLenient()
lenient.
By default, the value of this class property is true.lenient.setLenient(boolean)public static void setLenient(boolean lenient)
lenient.
This class property controls whether archive files and their member
directories get automatically created whenever required.
By default, the value of this class property is true!
Consider the following path: a/outer.zip/b/inner.zip/c.
Now let's assume that a exists as a plain directory in the
platform file system, while all other segments of this path don't, and
that the module TrueZIP Driver ZIP is present on the run-time class path
in order to detect outer.zip and inner.zip as ZIP files
according to the initial setup.
Now, if this class property is set to false, then an application
needs to call new TFile("a/outer.zip/b/inner.zip").mkdirs()
before it can actually create the innermost c entry as a file
or directory.
More formally, before an application can access an entry in a federated file system, all its parent directories need to exist, including archive files. This emulates the behaviour of the platform file system.
If this class property is set to true however, then any missing
parent directories (including archive files) up to the outermost archive
file outer.zip get automatically created when using operations
to create the innermost element of the path c.
This allows applications to succeed with doing this:
new TFile("a/outer.zip/b/inner.zip/c").createNewFile(),
or that:
new TFileOutputStream("a/outer.zip/b/inner.zip/c").
Note that in either case the parent directory of the outermost archive
file a must exist - TrueZIP does not automatically create
directories in the platform file system!
lenient - the value of the class property lenient.isLenient()public FsMountPoint getMountPoint()
public TFileSystemProvider provider()
provider in class java.nio.file.FileSystempublic void sync(BitField<FsSyncOption> options) throws FsSyncException
If a client application needs to sync an individual archive file, the following idiom could be used:
if (file.isArchive() && file.getEnclArchive() == null) // filter top level federated file system
if (file.isDirectory()) // ignore false positives
TFile.sync(file); // sync federated file system and all its members
Again, this will also sync all federated file systems which are
located within the file system referred to by file.options - a bit field of synchronization options.IllegalArgumentException - if archive is not a top level
federated file system or the combination of synchronization
options is illegal, e.g. if
FsSyncOption.FORCE_CLOSE_INPUT is cleared and
FsSyncOption.FORCE_CLOSE_OUTPUT is set or if the
synchronization option FsSyncOption.ABORT_CHANGES is set.FsSyncWarningException - if only warning conditions
occur.
This implies that the respective parent file system has been
updated with constraints, such as a failure to set the last
modification time of the entry for the federated file system
(i.e. archive file) in its parent file system.FsSyncException - if any error conditions occur.
This implies loss of data!sync(BitField)public void close()
throws FsSyncException
This method is equivalent to calling
sync(FsSyncOptions.UMOUNT).
The file system stays open after this call and can be subsequently used.
close in interface Closeableclose in interface AutoCloseableclose in class java.nio.file.FileSystemFsSyncWarningException - if only warning conditions
occur.
This implies that the respective parent file system has been
updated with constraints, such as a failure to set the last
modification time of the entry for the federated file system
(i.e. prospective archive file) in its parent file system.FsSyncException - if any error conditions occur.
This implies loss of data!#sync(TFile, BitField)public boolean isOpen()
isOpen in class java.nio.file.FileSystempublic boolean isReadOnly()
isReadOnly in class java.nio.file.FileSystempublic String getSeparator()
getSeparator in class java.nio.file.FileSystempublic Iterable<java.nio.file.Path> getRootDirectories()
getRootDirectories in class java.nio.file.FileSystempublic Iterable<java.nio.file.FileStore> getFileStores()
getFileStores in class java.nio.file.FileSystempublic Set<String> supportedFileAttributeViews()
supportedFileAttributeViews in class java.nio.file.FileSystempublic TPath getPath(String first, String... more)
getPath in class java.nio.file.FileSystempublic java.nio.file.PathMatcher getPathMatcher(String syntaxAndPattern)
getPathMatcher in class java.nio.file.FileSystempublic java.nio.file.attribute.UserPrincipalLookupService getUserPrincipalLookupService()
getUserPrincipalLookupService in class java.nio.file.FileSystempublic java.nio.file.WatchService newWatchService() throws IOException
newWatchService in class java.nio.file.FileSystemIOExceptionFsEntry getEntry(TPath path) throws IOException
IOExceptionInputSocket<?> getInputSocket(TPath path, BitField<FsInputOption> options)
OutputSocket<?> getOutputSocket(TPath path, BitField<FsOutputOption> options, @CheckForNull Entry template)
java.nio.file.DirectoryStream<java.nio.file.Path> newDirectoryStream(TPath path, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter) throws IOException
IOExceptionvoid createDirectory(TPath path, java.nio.file.attribute.FileAttribute<?>... attrs) throws IOException
IOExceptionvoid delete(TPath path) throws IOException
IOExceptionFsController<?> getController(FsCompositeDriver driver)
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.