Class FileSystemState
java.lang.Object
com.google.common.jimfs.FileSystemState
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FileTimeSourceprivate final Runnableprivate final AtomicBooleanprivate final AtomicIntegerCount of resources currently in the process of being registered. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks that the file system is open, throwingClosedFileSystemExceptionif it is not.voidclose()Closes the file system, runs theonClosecallback and closes all registered resources.booleanisOpen()Returns whether or not the file system is open.now()Returns the currentFileTime.<C extends Closeable>
Cregister(C resource) Registers the given resource to be closed when the file system is closed.voidunregister(Closeable resource) Unregisters the given resource.
-
Field Details
-
resources
-
fileTimeSource
-
onClose
-
open
-
registering
Count of resources currently in the process of being registered.
-
-
Constructor Details
-
FileSystemState
FileSystemState(FileTimeSource fileTimeSource, Runnable onClose)
-
-
Method Details
-
isOpen
public boolean isOpen()Returns whether or not the file system is open. -
checkOpen
public void checkOpen()Checks that the file system is open, throwingClosedFileSystemExceptionif it is not. -
register
Registers the given resource to be closed when the file system is closed. Should be called when the resource is opened. -
unregister
Unregisters the given resource. Should be called when the resource is closed. -
now
-
close
Closes the file system, runs theonClosecallback and closes all registered resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-