org.h2.store.fs
Class FileSystemDiskNio

java.lang.Object
  extended by org.h2.store.fs.FileSystem
      extended by org.h2.store.fs.FileSystemDisk
          extended by org.h2.store.fs.FileSystemDiskNio
Direct Known Subclasses:
FileSystemDiskNioMapped

public class FileSystemDiskNio
extends FileSystemDisk

This file system stores files on disk and uses java.nio to access the files. This class uses FileChannel.


Field Summary
 
Fields inherited from class org.h2.store.fs.FileSystem
PREFIX_MEMORY, PREFIX_MEMORY_LZF, PREFIX_NIO, PREFIX_NIO_MAPPED, PREFIX_SPLIT, PREFIX_ZIP
 
Constructor Summary
FileSystemDiskNio()
           
 
Method Summary
 java.lang.String createTempFile(java.lang.String name, java.lang.String suffix, boolean deleteOnExit, boolean inTempDir)
          Create a new temporary file.
 java.lang.String getAbsolutePath(java.lang.String fileName)
          Get the absolute file name.
static FileSystemDisk getInstance()
           
 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.
 java.lang.String[] listFiles(java.lang.String path)
          List the files in the given directory.
 java.lang.String normalize(java.lang.String fileName)
          Normalize a file name.
protected  FileObject open(java.lang.String fileName, java.lang.String mode)
          Try to open a file with this name and mode.
 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.
protected  java.lang.String translateFileName(java.lang.String fileName)
          Translate the file name to the native format.
 
Methods inherited from class org.h2.store.fs.FileSystemDisk
canWrite, copy, createDirs, createNewFile, delete, deleteRecursive, exists, fileStartsWith, freeMemoryAndFinalize, getFileName, getLastModified, isAbsolute, isDirectory, isReadOnly, length, openFileOutputStream, rename, trace, tryDelete
 
Methods inherited from class org.h2.store.fs.FileSystem
accepts, getInstance, mkdirs, register, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemDiskNio

public FileSystemDiskNio()
Method Detail

getInstance

public static FileSystemDisk getInstance()

createTempFile

public java.lang.String createTempFile(java.lang.String name,
                                       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 FileSystemDisk
Parameters:
name - 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

translateFileName

protected java.lang.String translateFileName(java.lang.String fileName)
Description copied from class: FileSystemDisk
Translate the file name to the native format. This will expand the home directory (~).

Overrides:
translateFileName in class FileSystemDisk
Parameters:
fileName - the file name
Returns:
the native file name

openFileInputStream

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

Overrides:
openFileInputStream in class FileSystemDisk
Parameters:
fileName - the file name
Returns:
the input stream
Throws:
java.io.IOException

normalize

public java.lang.String normalize(java.lang.String fileName)
                           throws java.sql.SQLException
Description copied from class: FileSystem
Normalize a file name.

Overrides:
normalize in class FileSystemDisk
Parameters:
fileName - the file name
Returns:
the normalized file name
Throws:
java.sql.SQLException

listFiles

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

Overrides:
listFiles in class FileSystemDisk
Parameters:
path - the directory
Returns:
the list of fully qualified file names
Throws:
java.sql.SQLException

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 FileSystemDisk
Parameters:
fileName - the file or directory name
Returns:
the parent directory name

getAbsolutePath

public java.lang.String getAbsolutePath(java.lang.String fileName)
Description copied from class: FileSystem
Get the absolute file name.

Overrides:
getAbsolutePath in class FileSystemDisk
Parameters:
fileName - the file name
Returns:
the absolute file name

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 FileSystemDisk
Parameters:
fileName - the file name
mode - the access mode. Supported are r, rw, rws, rwd
Returns:
the file object
Throws:
java.io.IOException

getPrefix

protected java.lang.String getPrefix()
Get the prefix for this file system.

Returns:
the prefix

open

protected FileObject open(java.lang.String fileName,
                          java.lang.String mode)
                   throws java.io.IOException
Try to open a file with this name and mode.

Parameters:
fileName - the file name
mode - the open mode
Returns:
the file object
Throws:
java.io.IOException - if opening fails