Package org.h2.store.fs.mem
Class FilePathMem
java.lang.Object
org.h2.store.fs.FilePath
org.h2.store.fs.mem.FilePathMem
- Direct Known Subclasses:
FilePathMemLZF
This file system keeps files fully in memory. There is an option to compress
file blocks to save memory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final FileMemData
private static final TreeMap
<String, FileMemData> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canWrite()
Check if the file is writable.(package private) boolean
Whether the file should be compressed.void
Create a directory (all required parent directories already exist).boolean
Create a new file.void
delete()
Delete a file or directory if it exists.boolean
exists()
Checks if a file exists.protected static String
getCanonicalPath
(String fileName) Get the canonical path for this file name.private FileMemData
Get the parent directory of a file or directory.Convert a file to a path.Get the scheme (prefix) for this file provider.boolean
Check if the file name includes a path.boolean
Check if it is a file or a directory.private boolean
isRoot()
long
Get the last modified date of a filevoid
Rename a file if this is allowed.List the files and directories in the given directory.Open a random access file object.boolean
Disable the ability to write.long
size()
Get the size of a file in bytesNormalize a file name.Methods inherited from class org.h2.store.fs.FilePath
createTempFile, get, getName, newFileChannelOutputStream, newInputStream, newOutputStream, register, toString, unregister, unwrap
-
Field Details
-
MEMORY_FILES
-
DIRECTORY
-
-
Constructor Details
-
FilePathMem
public FilePathMem()
-
-
Method Details
-
getPath
Description copied from class:FilePath
Convert a file to a path. This is similar tojava.nio.file.spi.FileSystemProvider.getPath
, but may return an object even if the scheme doesn't match in case of the default file provider. -
size
public long size()Description copied from class:FilePath
Get the size of a file in bytes -
moveTo
Description copied from class:FilePath
Rename a file if this is allowed. -
createFile
public boolean createFile()Description copied from class:FilePath
Create a new file.- Specified by:
createFile
in classFilePath
- Returns:
- true if creating was successful
-
exists
public boolean exists()Description copied from class:FilePath
Checks if a file exists. -
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. -
newDirectoryStream
Description copied from class:FilePath
List the files and directories in the given directory.- Specified by:
newDirectoryStream
in classFilePath
- Returns:
- the list of fully qualified file names
-
setReadOnly
public boolean setReadOnly()Description copied from class:FilePath
Disable the ability to write.- Specified by:
setReadOnly
in classFilePath
- Returns:
- true if the call was successful
-
canWrite
public boolean canWrite()Description copied from class:FilePath
Check if the file is writable. -
getParent
Description copied from class:FilePath
Get the parent directory of a file or directory. -
isDirectory
public boolean isDirectory()Description copied from class:FilePath
Check if it is a file or a directory.- Specified by:
isDirectory
in classFilePath
- Returns:
- true if it is a directory
-
isAbsolute
public boolean isAbsolute()Description copied from class:FilePath
Check if the file name includes a path.- Specified by:
isAbsolute
in classFilePath
- Returns:
- if the file name is absolute
-
toRealPath
Description copied from class:FilePath
Normalize a file name.- Specified by:
toRealPath
in classFilePath
- Returns:
- the normalized file name
-
lastModified
public long lastModified()Description copied from class:FilePath
Get the last modified date of a file- Specified by:
lastModified
in classFilePath
- Returns:
- the last modified date
-
createDirectory
public void createDirectory()Description copied from class:FilePath
Create a directory (all required parent directories already exist).- Specified by:
createDirectory
in classFilePath
-
open
Description copied from class:FilePath
Open a random access file object. -
getMemoryFile
-
isRoot
private boolean isRoot() -
getCanonicalPath
Get the canonical path for this file name.- Parameters:
fileName
- the file name- Returns:
- the canonical path
-
getScheme
Description copied from class:FilePath
Get the scheme (prefix) for this file provider. This is similar tojava.nio.file.spi.FileSystemProvider.getScheme
. -
compressed
boolean compressed()Whether the file should be compressed.- Returns:
- if it should be compressed.
-