Package org.h2.store.fs.encrypt

# Class FilePathEncrypt

java.lang.Object
org.h2.store.fs.FilePath
org.h2.store.fs.FilePathWrapper
org.h2.store.fs.encrypt.FilePathEncrypt

public class FilePathEncrypt extends FilePathWrapper
An encrypted file.

## Field Summary

### Fields inherited from class org.h2.store.fs.FilePath

`name`

## Constructor Summary

Constructors
Constructor
Description
`FilePathEncrypt()`

## Method Summary

Modifier and Type
Method
Description
`static byte[]`
`getPasswordBytes(char[] passwordChars)`
Convert a char array to a byte array, in UTF-16 format.
`protected String`
`getPrefix()`
`String`
`getScheme()`
Get the scheme (prefix) for this file provider.
`InputStream`
`newInputStream()`
Create an input stream to read from the file.
`OutputStream`
`newOutputStream(boolean append)`
Create an output stream to write into the file.
`FileChannel`
`open(String mode)`
Open a random access file object.
`static void`
`register()`
Register this file system.
`long`
`size()`
Get the size of a file in bytes
`FilePath`
`unwrap(String fileName)`
Get the base path for the given wrapped path.

### Methods inherited from class org.h2.store.fs.FilePathWrapper

`canWrite, createDirectory, createFile, createTempFile, delete, exists, getBase, getParent, getPath, isAbsolute, isDirectory, isRegularFile, lastModified, moveTo, newDirectoryStream, setReadOnly, toRealPath, unwrap, wrap`

### Methods inherited from class org.h2.store.fs.FilePath

`get, getName, newFileChannelOutputStream, register, toString, unregister`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### FilePathEncrypt

public FilePathEncrypt()

## Method Details

### register

public static void register()
Register this file system.

### open

public FileChannel open(String mode) throws IOException
Description copied from class: `FilePath`
Open a random access file object.

Overrides:
  `open` in class `FilePathWrapper`
Parameters:
  `mode` - the access mode. Supported are r, rw, rws, rwd
Returns:
  the file object
Throws:
  `IOException` - If an I/O error occurs

### getScheme

public String getScheme()
Description copied from class: `FilePath`
Get the scheme (prefix) for this file provider. This is similar to `java.nio.file.spi.FileSystemProvider.getScheme`.

Specified by:
  `getScheme` in class `FilePath`
Returns:
  the scheme

### getPrefix

protected String getPrefix()

Overrides:
  `getPrefix` in class `FilePathWrapper`

### unwrap

public FilePath unwrap(String fileName)
Description copied from class: `FilePathWrapper`
Get the base path for the given wrapped path.

Overrides:
  `unwrap` in class `FilePathWrapper`
Parameters:
  `fileName` - the path including the scheme prefix
Returns:
  the base file path

### size

public long size()
Description copied from class: `FilePath`
Get the size of a file in bytes

Overrides:
  `size` in class `FilePathWrapper`
Returns:
  the size in bytes

### newOutputStream

public OutputStream newOutputStream(boolean append) throws IOException
Description copied from class: `FilePath`
Create an output stream to write into the file.

Overrides:
  `newOutputStream` in class `FilePathWrapper`
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

### newInputStream

public InputStream newInputStream() throws IOException
Description copied from class: `FilePath`
Create an input stream to read from the file.

Overrides:
  `newInputStream` in class `FilePathWrapper`
Returns:
  the input stream
Throws:
  `IOException` - If an I/O error occurs

### getPasswordBytes

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` - the password characters
Returns:
  the byte array