class DirFile4 extends DirFile
Modifier and Type | Field and Description |
---|---|
private java.nio.channels.FileLock |
dbLock |
private java.nio.channels.FileChannel |
lockFileChannel |
private java.io.RandomAccessFile |
lockFileOpen |
EXCLUSIVE_FILE_LOCK, EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE, NO_FILE_LOCK_SUPPORT
Constructor and Description |
---|
DirFile4(DirFile directoryName,
java.lang.String fileName)
Construct a DirFile from a directory name and a file name.
|
DirFile4(java.lang.String path)
Construct a DirFile from a path name.
|
DirFile4(java.lang.String directoryName,
java.lang.String fileName)
Construct a DirFile from a directory name and a file name.
|
Modifier and Type | Method and Description |
---|---|
int |
getExclusiveFileLock()
Get an exclusive lock.
|
java.io.OutputStream |
getOutputStream(boolean append)
Creates an output stream from a file name.
|
StorageFile |
getParentDir()
Get the name of the parent directory if this name includes a parent.
|
StorageRandomAccessFile |
getRandomAccessFile(java.lang.String mode)
Get a random access (read/write) file.
|
void |
releaseExclusiveFileLock()
Release the resource associated with an earlier acquired exclusive lock
|
deleteAll, getInputStream, getOutputStream, getURL, limitAccessToOwner, renameTo
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
canWrite, createNewFile, delete, exists, getCanonicalPath, getName, getPath, isDirectory, length, list, mkdir, mkdirs, setReadOnly
private java.io.RandomAccessFile lockFileOpen
private java.nio.channels.FileChannel lockFileChannel
private java.nio.channels.FileLock dbLock
DirFile4(java.lang.String path)
path
- The path name.DirFile4(java.lang.String directoryName, java.lang.String fileName)
directoryName
- The directory part of the path name.fileName
- The name of the file within the directory.DirFile4(DirFile directoryName, java.lang.String fileName)
directoryName
- The directory part of the path name.fileName
- The name of the file within the directory.public StorageFile getParentDir()
getParentDir
in interface StorageFile
getParentDir
in class DirFile
public java.io.OutputStream getOutputStream(boolean append) throws java.io.FileNotFoundException
getOutputStream
in interface StorageFile
getOutputStream
in class DirFile
append
- If true then data will be appended to the end of the file, if it already exists.
If false and a normal file already exists with this name the file will first be truncated
to zero length.java.io.FileNotFoundException
- if the file exists but is a directory
rather than a regular file, does not exist but cannot be created, or
cannot be opened for any other reason.public int getExclusiveFileLock() throws StandardException
DirFile
getExclusiveFileLock
in interface StorageFile
getExclusiveFileLock
in class DirFile
StandardException
public void releaseExclusiveFileLock()
DirFile
releaseExclusiveFileLock
in interface StorageFile
releaseExclusiveFileLock
in class DirFile
DirFile.getExclusiveFileLock()
public StorageRandomAccessFile getRandomAccessFile(java.lang.String mode) throws java.io.FileNotFoundException
getRandomAccessFile
in interface StorageFile
getRandomAccessFile
in class DirFile
mode
- "r", "rw", "rws", or "rwd". The "rws" and "rwd" modes specify
that the data is to be written to persistent store, consistent with the
java.io.RandomAccessFile class ("synchronized" with the persistent
storage, in the file system meaning of the word "synchronized"). However
the implementation is not required to implement the "rws" or "rwd"
modes. The implementation may treat "rws" and "rwd" as "rw". It is up to
the user of this interface to call the StorageRandomAccessFile.sync
method. If the "rws" or "rwd" modes are supported and the
RandomAccessFile was opened in "rws" or "rwd" mode then the
implementation of StorageRandomAccessFile.sync need not do anything.java.lang.IllegalArgumentException
- if the mode argument is not equal to one of "r", "rw", "rws", or "rwd".java.io.FileNotFoundException
- if the file exists but is a directory rather than a regular
file, or cannot be opened or created for any other reason .Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.