Top Description Fields Constructors Methods
org.h2.store.fs.mem

public Class FilePathMem

extends FilePath
Class Inheritance
Known Direct Subclasses
org.h2.store.fs.mem.FilePathMemLZF
Imports
java.nio.channels.FileChannel, java.util.ArrayList, .List, .TreeMap, org.h2.api.ErrorCode, org.h2.message.DbException, org.h2.store.fs.FilePath

This file system keeps files fully in memory. There is an option to compress file blocks to save memory.

Field Summary

Modifier and TypeField and Description
private static final FileMemData
private static final TreeMap<String, FileMemData>
Inherited from org.h2.store.fs.FilePath:
name

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canWrite()

Implements abstract org.h2.store.fs.FilePath.canWrite.

Check if the file is writable.

pack-priv boolean

Returns:

if it should be compressed.
compressed
()

Whether the file should be compressed.

public void
createDirectory()

Implements abstract org.h2.store.fs.FilePath.createDirectory.

Create a directory (all required parent directories already exist).

public boolean
createFile()

Implements abstract org.h2.store.fs.FilePath.createFile.

Create a new file.

public void
delete()

Implements abstract org.h2.store.fs.FilePath.delete.

Delete a file or directory if it exists.

public boolean
exists()

Implements abstract org.h2.store.fs.FilePath.exists.

Checks if a file exists.

protected static String

Returns:

the canonical path
getCanonicalPath
(String
the file name
fileName
)

Get the canonical path for this file name.

private FileMemData
public FilePathMem
getParent()

Implements abstract org.h2.store.fs.FilePath.getParent.

Get the parent directory of a file or directory.

public FilePathMem
getPath(String
the path
path
)

Implements abstract org.h2.store.fs.FilePath.getPath.

Convert a file to a path.

public String
getScheme()

Implements abstract org.h2.store.fs.FilePath.getScheme.

Get the scheme (prefix) for this file provider.

public boolean
isAbsolute()

Implements abstract org.h2.store.fs.FilePath.isAbsolute.

Check if the file name includes a path.

public boolean
isDirectory()

Implements abstract org.h2.store.fs.FilePath.isDirectory.

Check if it is a file or a directory.

public boolean
isRegularFile()

Implements abstract org.h2.store.fs.FilePath.isRegularFile.

Check if it is a regular file.

private boolean
public long
lastModified()

Implements abstract org.h2.store.fs.FilePath.lastModified.

Get the last modified date of a file

public void
moveTo(FilePath
the new fully qualified file name
newName
,
boolean
whether the move should be atomic, and the target file should be replaced if it exists and replacing is possible
atomicReplace
)

Implements abstract org.h2.store.fs.FilePath.moveTo.

Rename a file if this is allowed.

public List<FilePath>
newDirectoryStream()

Implements abstract org.h2.store.fs.FilePath.newDirectoryStream.

List the files and directories in the given directory.

public FileChannel
open(String
the access mode. Supported are r, rw, rws, rwd
mode
)

Implements abstract org.h2.store.fs.FilePath.open.

Open a random access file object.

public boolean
setReadOnly()

Implements abstract org.h2.store.fs.FilePath.setReadOnly.

Disable the ability to write.

public long
size()

Implements abstract org.h2.store.fs.FilePath.size.

Get the size of a file in bytes

public FilePathMem
toRealPath()

Implements abstract org.h2.store.fs.FilePath.toRealPath.

Normalize a file name.

Inherited from org.h2.store.fs.FilePath:
createTempFilegetgetNamenewFileChannelOutputStreamnewInputStreamnewOutputStreamregistertoStringunregisterunwrap

Field Detail

DIRECTORYback to summary
private static final FileMemData DIRECTORY
MEMORY_FILESback to summary
private static final TreeMap<String, FileMemData> MEMORY_FILES

Constructor Detail

FilePathMemback to summary
public FilePathMem()

Method Detail

canWriteback to summary
public boolean canWrite()

Implements abstract org.h2.store.fs.FilePath.canWrite.

Doc from org.h2.store.fs.FilePath.canWrite.

Check if the file is writable.

Returns:boolean

if the file is writable

Annotations
@Override
compressedback to summary
pack-priv boolean compressed()

Whether the file should be compressed.

Returns:boolean

if it should be compressed.

createDirectoryback to summary
public void createDirectory()

Implements abstract org.h2.store.fs.FilePath.createDirectory.

Doc from org.h2.store.fs.FilePath.createDirectory.

Create a directory (all required parent directories already exist).

Annotations
@Override
createFileback to summary
public boolean createFile()

Implements abstract org.h2.store.fs.FilePath.createFile.

Doc from org.h2.store.fs.FilePath.createFile.

Create a new file.

Returns:boolean

true if creating was successful

Annotations
@Override
deleteback to summary
public void delete()

Implements abstract org.h2.store.fs.FilePath.delete.

Doc from org.h2.store.fs.FilePath.delete.

Delete a file or directory if it exists. Directories may only be deleted if they are empty.

Annotations
@Override
existsback to summary
public boolean exists()

Implements abstract org.h2.store.fs.FilePath.exists.

Doc from org.h2.store.fs.FilePath.exists.

Checks if a file exists.

Returns:boolean

true if it exists

Annotations
@Override
getCanonicalPathback to summary
protected static String getCanonicalPath(String fileName)

Get the canonical path for this file name.

Parameters
fileName:String

the file name

Returns:String

the canonical path

getMemoryFileback to summary
private FileMemData getMemoryFile()
getParentback to summary
public FilePathMem getParent()

Implements abstract org.h2.store.fs.FilePath.getParent.

Doc from org.h2.store.fs.FilePath.getParent.

Get the parent directory of a file or directory.

Returns:FilePathMem

the parent directory name

Annotations
@Override
getPathback to summary
public FilePathMem getPath(String path)

Implements abstract org.h2.store.fs.FilePath.getPath.

Doc from org.h2.store.fs.FilePath.getPath.

Convert a file to a path. This is similar to java.nio.file.spi.FileSystemProvider.getPath, but may return an object even if the scheme doesn't match in case of the default file provider.

Parameters
path:String

the path

Returns:FilePathMem

the file path object

Annotations
@Override
getSchemeback to summary
public String getScheme()

Implements abstract org.h2.store.fs.FilePath.getScheme.

Doc from org.h2.store.fs.FilePath.getScheme.

Get the scheme (prefix) for this file provider. This is similar to java.nio.file.spi.FileSystemProvider.getScheme.

Returns:String

the scheme

Annotations
@Override
isAbsoluteback to summary
public boolean isAbsolute()

Implements abstract org.h2.store.fs.FilePath.isAbsolute.

Doc from org.h2.store.fs.FilePath.isAbsolute.

Check if the file name includes a path.

Returns:boolean

if the file name is absolute

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Implements abstract org.h2.store.fs.FilePath.isDirectory.

Doc from org.h2.store.fs.FilePath.isDirectory.

Check if it is a file or a directory.

Returns:boolean

true if it is a directory

Annotations
@Override
isRegularFileback to summary
public boolean isRegularFile()

Implements abstract org.h2.store.fs.FilePath.isRegularFile.

Doc from org.h2.store.fs.FilePath.isRegularFile.

Check if it is a regular file.

Returns:boolean

true if it is a regular file

Annotations
@Override
isRootback to summary
private boolean isRoot()
lastModifiedback to summary
public long lastModified()

Implements abstract org.h2.store.fs.FilePath.lastModified.

Doc from org.h2.store.fs.FilePath.lastModified.

Get the last modified date of a file

Returns:long

the last modified date

Annotations
@Override
moveToback to summary
public void moveTo(FilePath newName, boolean atomicReplace)

Implements abstract org.h2.store.fs.FilePath.moveTo.

Doc from org.h2.store.fs.FilePath.moveTo.

Rename a file if this is allowed.

Parameters
newName:FilePath

the new fully qualified file name

atomicReplace:boolean

whether the move should be atomic, and the target file should be replaced if it exists and replacing is possible

Annotations
@Override
newDirectoryStreamback to summary
public List<FilePath> newDirectoryStream()

Implements abstract org.h2.store.fs.FilePath.newDirectoryStream.

Doc from org.h2.store.fs.FilePath.newDirectoryStream.

List the files and directories in the given directory.

Returns:List<FilePath>

the list of fully qualified file names

Annotations
@Override
openback to summary
public FileChannel open(String mode)

Implements abstract org.h2.store.fs.FilePath.open.

Doc from org.h2.store.fs.FilePath.open.

Open a random access file object.

Parameters
mode:String

the access mode. Supported are r, rw, rws, rwd

Returns:FileChannel

the file object

Annotations
@Override
setReadOnlyback to summary
public boolean setReadOnly()

Implements abstract org.h2.store.fs.FilePath.setReadOnly.

Doc from org.h2.store.fs.FilePath.setReadOnly.

Disable the ability to write.

Returns:boolean

true if the call was successful

Annotations
@Override
sizeback to summary
public long size()

Implements abstract org.h2.store.fs.FilePath.size.

Doc from org.h2.store.fs.FilePath.size.

Get the size of a file in bytes

Returns:long

the size in bytes

Annotations
@Override
toRealPathback to summary
public FilePathMem toRealPath()

Implements abstract org.h2.store.fs.FilePath.toRealPath.

Doc from org.h2.store.fs.FilePath.toRealPath.

Normalize a file name.

Returns:FilePathMem

the normalized file name

Annotations
@Override