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

public Class FilePathEncrypt

extends FilePathWrapper
Class Inheritance
Imports
java.io.IOException, .InputStream, .OutputStream, java.nio.channels.Channels, .FileChannel, java.nio.charset.StandardCharsets, org.h2.store.fs.FilePath, .FilePathWrapper, .FileUtils

An encrypted file.

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

the byte array
getPasswordBytes
(char[]
the password characters
passwordChars
)

Convert a char array to a byte array, in UTF-16 format.

protected String
public String
getScheme()

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

Get the scheme (prefix) for this file provider.

public InputStream
newInputStream()

Overrides org.h2.store.fs.FilePathWrapper.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.FilePathWrapper.newOutputStream.

Create an output stream to write into the file.

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

Overrides org.h2.store.fs.FilePathWrapper.open.

Open a random access file object.

private String[]

Returns:

an array with algorithm, password, and base file name
parse
(String
the file name
fileName
)

Split the file name into algorithm, password, and base file name.

public static void
register()

Register this file system.

public long
size()

Overrides org.h2.store.fs.FilePathWrapper.size.

Get the size of a file in bytes

public FilePath
unwrap(String
the path including the scheme prefix
fileName
)

Overrides org.h2.store.fs.FilePathWrapper.unwrap.

Get the base path for the given wrapped path.

Inherited from org.h2.store.fs.FilePathWrapper:
canWritecreateDirectorycreateFilecreateTempFiledeleteexistsgetBasegetParentgetPathisAbsoluteisDirectoryisRegularFilelastModifiedmoveTonewDirectoryStreamsetReadOnlytoRealPathunwrapwrap

Field Detail

SCHEMEback to summary
private static final String SCHEME

Constructor Detail

FilePathEncryptback to summary
public FilePathEncrypt()

Method Detail

getPasswordBytesback to summary
public static byte[] getPasswordBytes(char[] passwordChars)

Convert a char array to a byte array, in UTF-16 format. The char array is not cleared after use (this must be done by the caller).

Parameters
passwordChars:char[]

the password characters

Returns:byte[]

the byte array

getPrefixback to summary
protected String getPrefix()

Overrides org.h2.store.fs.FilePathWrapper.getPrefix.

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
newInputStreamback to summary
public InputStream newInputStream() throws IOException

Overrides org.h2.store.fs.FilePathWrapper.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.FilePathWrapper.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

Overrides org.h2.store.fs.FilePathWrapper.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
parseback to summary
private String[] parse(String fileName)

Split the file name into algorithm, password, and base file name.

Parameters
fileName:String

the file name

Returns:String[]

an array with algorithm, password, and base file name

registerback to summary
public static void register()

Register this file system.

sizeback to summary
public long size()

Overrides org.h2.store.fs.FilePathWrapper.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
unwrapback to summary
public FilePath unwrap(String fileName)

Overrides org.h2.store.fs.FilePathWrapper.unwrap.

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

Get the base path for the given wrapped path.

Parameters
fileName:String

the path including the scheme prefix

Returns:FilePath

the base file path

Annotations
@Override