java.lang.Object
com.aoapps.io.filesystems.FileSystemWrapper
- All Implemented Interfaces:
FileSystem
- Direct Known Subclasses:
RandomFailFileSystem,ReadOnlyFileSystem
A file system that wraps another to intercept and otherwise modify interactions.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classWrapsPathIterator, wrapping each result inFileSystemWrapper.PathIteratorWrapper.next().protected static classWraps aPath. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckSubPath(Path parent, String name) Checks that a given path name is acceptable to this file system.createDirectory(Path path) Atomically creates a directory (must not have already existed).createFile(Path path) Atomically creates an empty file (must not have already existed).voidDeletes the file system object at the given path.Joins the array of names to a path object.Lists the children of the given path in no specific order.Locks a file in exclusive mode.Parses a string representation of a path.longGets the size of the file system object at the given path.protected PathunwrapPath(Path path) Unwraps a path.protected FileSystemWrapper.PathWrapperWraps a path.protected FileSystemWrapper.PathWrapperwrapSubPath(FileSystemWrapper.PathWrapper parent, Path subPath) Wraps a new sub path.
-
Field Details
-
wrappedFileSystem
-
-
Constructor Details
-
FileSystemWrapper
-
-
Method Details
-
wrapSubPath
protected FileSystemWrapper.PathWrapper wrapSubPath(FileSystemWrapper.PathWrapper parent, Path subPath) Wraps a new sub path. -
wrapPath
Wraps a path. -
unwrapPath
Unwraps a path. -
checkSubPath
Description copied from interface:FileSystemChecks that a given path name is acceptable to this file system. Regular path rules are already checked, this is for additional file system specific constraints. The root path is never passed here.- Specified by:
checkSubPathin interfaceFileSystem- Parameters:
name- The path to check, must be from this file system.- Throws:
InvalidPathException- If the path is not acceptable
-
join
Description copied from interface:FileSystemJoins the array of names to a path object. Stops at the end of the array or the firstnullelement.- Specified by:
joinin interfaceFileSystem- Throws:
InvalidPathException- See Also:
-
parsePath
Description copied from interface:FileSystemParses a string representation of a path.- Specified by:
parsePathin interfaceFileSystem- Throws:
InvalidPathException- See Also:
-
list
Description copied from interface:FileSystemLists the children of the given path in no specific order. It is possible that paths may be returned that no longer exist. It is also possible that new file system objects created after the beginning of iteration are not returned.- Specified by:
listin interfaceFileSystem- Parameters:
path- Must be from this file system.- Returns:
- a read-only iterator of children
- Throws:
IOException- if an underlying I/O error occurs.
-
delete
Description copied from interface:FileSystemDeletes the file system object at the given path.- Specified by:
deletein interfaceFileSystem- Parameters:
path- Must be from this file system.- Throws:
IOException- if an underlying I/O error occurs.
-
size
Description copied from interface:FileSystemGets the size of the file system object at the given path.- Specified by:
sizein interfaceFileSystem- Parameters:
path- Must be from this file system.- Throws:
IOException- if an underlying I/O error occurs.
-
createFile
Description copied from interface:FileSystemAtomically creates an empty file (must not have already existed).- Specified by:
createFilein interfaceFileSystem- Returns:
- returns the path
- Throws:
IOException- if an underlying I/O error occurs.
-
createDirectory
Description copied from interface:FileSystemAtomically creates a directory (must not have already existed).- Specified by:
createDirectoryin interfaceFileSystem- Returns:
- returns the path
- Throws:
IOException- if an underlying I/O error occurs.
-
lock
Description copied from interface:FileSystemLocks a file in exclusive mode. File range and shared locks not currently supported. The lock must be closed to unlock, usually in a try/finally or try-with-resources block. The locks are not reentrant, attempting to obtain the lock from the same thread will result in deadlock.- Specified by:
lockin interfaceFileSystem- Throws:
IOException- if an underlying I/O error occurs.- See Also:
-
