java.lang.Object
com.aoapps.io.filesystems.TempFileSystem
- All Implemented Interfaces:
FileSystem
A temporary file system stored in the Java heap.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckSubPath(Path parent, String name) Temporary file systems support all possible paths.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.Lists the children of the given path in no specific order.Locks a file in exclusive mode.longGets the size of the file system object at the given path.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.aoapps.io.filesystems.FileSystem
join, parsePath
-
Field Details
-
files
-
-
Constructor Details
-
TempFileSystem
public TempFileSystem()Creates a new temp filesystem.
-
-
Method Details
-
checkSubPath
Temporary file systems support all possible paths.- Specified by:
checkSubPathin interfaceFileSystem- Parameters:
name- The path to check, must be from this file system.
-
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:
NoSuchFileException- if the path does not existNotDirectoryException- if the path is not a directory
-
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.
-
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.
-
createFile
Description copied from interface:FileSystemAtomically creates an empty file (must not have already existed).- Specified by:
createFilein interfaceFileSystem- Returns:
- returns the path
-
createDirectory
Description copied from interface:FileSystemAtomically creates a directory (must not have already existed).- Specified by:
createDirectoryin interfaceFileSystem- Returns:
- returns the path
-
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- See Also:
-
