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

public abstract Class FilePathWrapper

extends FilePath
Class Inheritance
Known Direct Subclasses
org.h2.store.fs.async.FilePathAsync, org.h2.store.fs.encrypt.FilePathEncrypt, org.h2.store.fs.niomapped.FilePathNioMapped, org.h2.store.fs.rec.FilePathRec, org.h2.store.fs.retry.FilePathRetryOnInterrupt, org.h2.store.fs.split.FilePathSplit, org.h2.mvstore.cache.FilePathCache
Imports
java.io.IOException, .InputStream, .OutputStream, java.nio.channels.FileChannel, java.util.List

The base class for wrapping / delegating file systems such as the split file system.

Field Summary

Modifier and TypeField and Description
private FilePath
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.

private FilePathWrapper
create(String path, FilePath base)

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 FilePath
createTempFile(String
the suffix
suffix
,
boolean
if the file should be stored in the temporary directory
inTempDir
)

Overrides org.h2.store.fs.FilePath.createTempFile.

Create a new temporary 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 FilePath
public FilePath
getParent()

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

Get the parent directory of a file or directory.

public FilePathWrapper
getPath(String
the path
path
)

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

Convert a file to a path.

protected String
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.

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 InputStream
newInputStream()

Overrides org.h2.store.fs.FilePath.newInputStream.

Create an input stream to read from the file.

public OutputStream
newOutputStream(boolean
if true, the file will grow, if false, the file will be truncated first
append
)

Overrides org.h2.store.fs.FilePath.newOutputStream.

Create an output stream to write into the file.

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 FilePath
toRealPath()

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

Normalize a file name.

public FilePath
unwrap()

Overrides org.h2.store.fs.FilePath.unwrap.

Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).

protected FilePath

Returns:

the base file path
unwrap
(String
the path including the scheme prefix
path
)

Get the base path for the given wrapped path.

public FilePathWrapper

Returns:

the wrapped path
wrap
(FilePath
the base path
base
)

Create a wrapped path instance for the given base path.

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

Field Detail

baseback to summary
private FilePath base

Constructor Detail

FilePathWrapperback to summary
public FilePathWrapper()

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
createback to summary
private FilePathWrapper create(String path, FilePath base)
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
createTempFileback to summary
public FilePath createTempFile(String suffix, boolean inTempDir) throws IOException

Overrides org.h2.store.fs.FilePath.createTempFile.

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

Create a new temporary file.

Parameters
suffix:String

the suffix

inTempDir:boolean

if the file should be stored in the temporary directory

Returns:FilePath

the name of the created file

Annotations
@Override
Exceptions
IOException:
on failure
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
getBaseback to summary
protected FilePath getBase()
getParentback to summary
public FilePath 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:FilePath

the parent directory name

Annotations
@Override
getPathback to summary
public FilePathWrapper 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:FilePathWrapper

the file path object

Annotations
@Override
getPrefixback to summary
protected String getPrefix()
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
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
newInputStreamback to summary
public InputStream newInputStream() throws IOException

Overrides org.h2.store.fs.FilePath.newInputStream.

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

Create an input stream to read from the file.

Returns:InputStream

the input stream

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
newOutputStreamback to summary
public OutputStream newOutputStream(boolean append) throws IOException

Overrides org.h2.store.fs.FilePath.newOutputStream.

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

Create an output stream to write into the file.

Parameters
append:boolean

if true, the file will grow, if false, the file will be truncated first

Returns:OutputStream

the output stream

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openback to summary
public FileChannel open(String mode) throws IOException

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
Exceptions
IOException:
If an I/O error occurs
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 FilePath toRealPath()

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

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

Normalize a file name.

Returns:FilePath

the normalized file name

Annotations
@Override
unwrapback to summary
public FilePath unwrap()

Overrides org.h2.store.fs.FilePath.unwrap.

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

Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).

Returns:FilePath

the unwrapped path

Annotations
@Override
unwrapback to summary
protected FilePath unwrap(String path)

Get the base path for the given wrapped path.

Parameters
path:String

the path including the scheme prefix

Returns:FilePath

the base file path

wrapback to summary
public FilePathWrapper wrap(FilePath base)

Create a wrapped path instance for the given base path.

Parameters
base:FilePath

the base path

Returns:FilePathWrapper

the wrapped path