Package org.h2.store.fs.rec
Class FilePathRec
java.lang.Object
org.h2.store.fs.FilePath
org.h2.store.fs.FilePathWrapper
org.h2.store.fs.rec.FilePathRec
A file system that records all write operations and can re-play them.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final FilePathRec
private static Recorder
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Create a new file.createTempFile
(String suffix, boolean inTempDir) Create a new temporary file.void
delete()
Delete a file or directory if it exists.Get the prefix for this file system.boolean
isTrace()
(package private) void
Log the operation.(package private) void
Log the operation.void
Rename a file if this is allowed.newOutputStream
(boolean append) Create an output stream to write into the file.Open a random access file object.static void
register()
Register the file system.static void
setRecorder
(Recorder recorder) Set the recorder class.void
setTrace
(boolean trace) Methods inherited from class org.h2.store.fs.FilePathWrapper
canWrite, createDirectory, exists, getBase, getParent, getPath, getPrefix, isAbsolute, isDirectory, lastModified, newDirectoryStream, newInputStream, setReadOnly, size, toRealPath, unwrap, unwrap, wrap
Methods inherited from class org.h2.store.fs.FilePath
get, getName, newFileChannelOutputStream, register, toString, unregister
-
Field Details
-
INSTANCE
-
recorder
-
trace
private boolean trace
-
-
Constructor Details
-
FilePathRec
public FilePathRec()
-
-
Method Details
-
register
public static void register()Register the file system. -
setRecorder
Set the recorder class.- Parameters:
recorder
- the recorder
-
createFile
public boolean createFile()Description copied from class:FilePath
Create a new file.- Overrides:
createFile
in classFilePathWrapper
- Returns:
- true if creating was successful
-
createTempFile
Description copied from class:FilePath
Create a new temporary file.- Overrides:
createTempFile
in classFilePathWrapper
- Parameters:
suffix
- the suffixinTempDir
- if the file should be stored in the temporary directory- Returns:
- the name of the created file
- Throws:
IOException
- on failure
-
delete
public void delete()Description copied from class:FilePath
Delete a file or directory if it exists. Directories may only be deleted if they are empty.- Overrides:
delete
in classFilePathWrapper
-
open
Description copied from class:FilePath
Open a random access file object.- Overrides:
open
in classFilePathWrapper
- Parameters:
mode
- the access mode. Supported are r, rw, rws, rwd- Returns:
- the file object
- Throws:
IOException
- If an I/O error occurs
-
newOutputStream
Description copied from class:FilePath
Create an output stream to write into the file.- Overrides:
newOutputStream
in classFilePathWrapper
- Parameters:
append
- if true, the file will grow, if false, the file will be truncated first- Returns:
- the output stream
- Throws:
IOException
- If an I/O error occurs
-
moveTo
Description copied from class:FilePath
Rename a file if this is allowed.- Overrides:
moveTo
in classFilePathWrapper
- Parameters:
newPath
- the new fully qualified file nameatomicReplace
- whether the move should be atomic, and the target file should be replaced if it exists and replacing is possible
-
isTrace
public boolean isTrace() -
setTrace
public void setTrace(boolean trace) -
log
Log the operation.- Parameters:
op
- the operationfileName
- the file name(s)
-
log
Log the operation.- Parameters:
op
- the operationfileName
- the file namedata
- the data or nullx
- the value or 0
-
getScheme
Get the prefix for this file system.
-