org.h2.dev.fs
Class FileSystemCrypt

java.lang.Object
  extended by org.h2.store.fs.FileSystem
      extended by org.h2.store.fs.FileSystemWrapper
          extended by org.h2.dev.fs.FileSystemCrypt

public class FileSystemCrypt
extends FileSystemWrapper

A file system that encrypts the contents of the files.


Field Summary
static java.lang.String PREFIX
          The prefix to use for this file system.
 
Constructor Summary
FileSystemCrypt()
           
 
Method Summary
 java.lang.String createTempFile(java.lang.String prefix, java.lang.String suffix, boolean deleteOnExit, boolean inTempDir)
          Create a new temporary file.
 java.lang.String getCanonicalPath(java.lang.String fileName)
          Normalize a file name.
 java.lang.String getParent(java.lang.String fileName)
          Get the parent directory of a file or directory.
protected  java.lang.String getPrefix()
          Get the prefix for this file system.
 long length(java.lang.String fileName)
          Get the length of a file.
 java.lang.String[] listFiles(java.lang.String directory)
          List the files in the given directory.
 java.io.InputStream openFileInputStream(java.lang.String fileName)
          Create an input stream to read from the file.
 FileObject openFileObject(java.lang.String fileName, java.lang.String mode)
          Open a random access file object.
 java.io.OutputStream openFileOutputStream(java.lang.String fileName, boolean append)
          Create an output stream to write into the file.
static FileSystemCrypt register()
          Register the file system.
 java.lang.String unwrap(java.lang.String fileName)
          Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).
 
Methods inherited from class org.h2.store.fs.FileSystemWrapper
accepts, canWrite, copy, createDirs, createNewFile, delete, deleteRecursive, exists, fileStartsWith, getFileName, getLastModified, isAbsolute, isDirectory, isReadOnly, rename, setReadOnly, tryDelete
 
Methods inherited from class org.h2.store.fs.FileSystem
getInstance, getNextTempFileNamePart, mkdirs, register, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX

public static final java.lang.String PREFIX
The prefix to use for this file system.

See Also:
Constant Field Values
Constructor Detail

FileSystemCrypt

public FileSystemCrypt()
Method Detail

getPrefix

protected java.lang.String getPrefix()
Description copied from class: FileSystemWrapper
Get the prefix for this file system.

Specified by:
getPrefix in class FileSystemWrapper
Returns:
the prefix

register

public static FileSystemCrypt register()
Register the file system.

Returns:
the instance

length

public long length(java.lang.String fileName)
Description copied from class: FileSystem
Get the length of a file.

Overrides:
length in class FileSystemWrapper
Parameters:
fileName - the file name
Returns:
the length in bytes

openFileObject

public FileObject openFileObject(java.lang.String fileName,
                                 java.lang.String mode)
                          throws java.io.IOException
Description copied from class: FileSystem
Open a random access file object.

Overrides:
openFileObject in class FileSystemWrapper
Parameters:
fileName - the file name
mode - the access mode. Supported are r, rw, rws, rwd
Returns:
the file object
Throws:
java.io.IOException

openFileOutputStream

public java.io.OutputStream openFileOutputStream(java.lang.String fileName,
                                                 boolean append)
Description copied from class: FileSystem
Create an output stream to write into the file.

Overrides:
openFileOutputStream in class FileSystemWrapper
Parameters:
fileName - the file name
append - if true, the file will grow, if false, the file will be truncated first
Returns:
the output stream

openFileInputStream

public java.io.InputStream openFileInputStream(java.lang.String fileName)
Description copied from class: FileSystem
Create an input stream to read from the file.

Overrides:
openFileInputStream in class FileSystemWrapper
Parameters:
fileName - the file name
Returns:
the input stream

getParent

public java.lang.String getParent(java.lang.String fileName)
Description copied from class: FileSystem
Get the parent directory of a file or directory.

Overrides:
getParent in class FileSystemWrapper
Parameters:
fileName - the file or directory name
Returns:
the parent directory name

listFiles

public java.lang.String[] listFiles(java.lang.String directory)
Description copied from class: FileSystem
List the files in the given directory.

Overrides:
listFiles in class FileSystemWrapper
Parameters:
directory - the directory
Returns:
the list of fully qualified file names

getCanonicalPath

public java.lang.String getCanonicalPath(java.lang.String fileName)
Description copied from class: FileSystem
Normalize a file name.

Overrides:
getCanonicalPath in class FileSystemWrapper
Parameters:
fileName - the file name
Returns:
the normalized file name

unwrap

public java.lang.String unwrap(java.lang.String fileName)
Description copied from class: FileSystem
Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).

Overrides:
unwrap in class FileSystemWrapper
Parameters:
fileName - the file name
Returns:
the unwrapped

createTempFile

public java.lang.String createTempFile(java.lang.String prefix,
                                       java.lang.String suffix,
                                       boolean deleteOnExit,
                                       boolean inTempDir)
                                throws java.io.IOException
Description copied from class: FileSystem
Create a new temporary file.

Overrides:
createTempFile in class FileSystemWrapper
Parameters:
prefix - the prefix of the file name (including directory name if required)
suffix - the suffix
deleteOnExit - if the file should be deleted when the virtual machine exists
inTempDir - if the file should be stored in the temporary directory
Returns:
the name of the created file
Throws:
java.io.IOException