Class FilePathEncrypt
java.lang.Object
org.h2.store.fs.FilePath
org.h2.store.fs.FilePathWrapper
org.h2.store.fs.encrypt.FilePathEncrypt
An encrypted file.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]getPasswordBytes(char[] passwordChars) Convert a char array to a byte array, in UTF-16 format.protected StringGet the scheme (prefix) for this file provider.Create an input stream to read from the file.newOutputStream(boolean append) Create an output stream to write into the file.Open a random access file object.private String[]Split the file name into algorithm, password, and base file name.static voidregister()Register this file system.longsize()Get the size of a file in bytesGet the base path for the given wrapped path.Methods inherited from class FilePathWrapper
canWrite, createDirectory, createFile, createTempFile, delete, exists, getBase, getParent, getPath, isAbsolute, isDirectory, lastModified, moveTo, newDirectoryStream, setReadOnly, toRealPath, unwrap, wrapMethods inherited from class FilePath
get, getName, newFileChannelOutputStream, register, toString, unregister
-
Field Details
-
SCHEME
- See Also:
-
-
Constructor Details
-
FilePathEncrypt
public FilePathEncrypt()
-
-
Method Details
-
register
public static void register()Register this file system. -
open
Description copied from class:FilePathOpen a random access file object.- Overrides:
openin classFilePathWrapper- Parameters:
mode- the access mode. Supported are r, rw, rws, rwd- Returns:
- the file object
- Throws:
IOException- If an I/O error occurs
-
getScheme
-
getPrefix
- Overrides:
getPrefixin classFilePathWrapper
-
unwrap
Description copied from class:FilePathWrapperGet the base path for the given wrapped path.- Overrides:
unwrapin classFilePathWrapper- Parameters:
fileName- the path including the scheme prefix- Returns:
- the base file path
-
size
public long size()Description copied from class:FilePathGet the size of a file in bytes- Overrides:
sizein classFilePathWrapper- Returns:
- the size in bytes
-
newOutputStream
Description copied from class:FilePathCreate an output stream to write into the file.- Overrides:
newOutputStreamin classFilePathWrapper- 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
Description copied from class:FilePathCreate an input stream to read from the file.- Overrides:
newInputStreamin classFilePathWrapper- Returns:
- the input stream
- Throws:
IOException- If an I/O error occurs
-
parse
-
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
-