Package org.apache.derby.impl.io
Class CPFile
- All Implemented Interfaces:
StorageFile
This class provides a class path based implementation of the StorageFile interface. It is used by the
database engine to access persistent data and transaction logs under the classpath subsubprotocol.
-
Field Summary
Fields inherited from class org.apache.derby.impl.io.InputStreamFile
nameStart, path, storageFactory
Fields inherited from interface org.apache.derby.io.StorageFile
EXCLUSIVE_FILE_LOCK, EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE, NO_FILE_LOCK_SUPPORT
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
(package private)
CPFile
(CPStorageFactory storageFactory, String path) private
CPFile
(CPStorageFactory storageFactory, String child, int pathLen) (package private)
CPFile
(CPStorageFactory storageFactory, String parent, String name) -
Method Summary
Modifier and TypeMethodDescriptionboolean
exists()
Tests whether the named file exists.private static ClassLoader
getContextClassLoader
(Thread thread) Privileged wrapper forThread.getContextClassLoader()
.Creates an input stream from a file name.(package private) StorageFile
getParentDir
(int pathLen) Get the parent of this file.private static URL
getResource
(ClassLoader cl, String name) Privileged wrapper forClassLoader.getResource(String)
.private static InputStream
getResourceAsStream
(ClassLoader cl, String name) Privileged wrapper forClassLoader.getResourceAsStream(String)
.private static URL
getSystemResource
(String name) Privileged wrapper forClassLoader.getSystemResource(String)
.private static InputStream
Privileged wrapper forClassLoader.getSystemResourceAsStream(String)
.private URL
getURL()
Return a URL for this file (resource).Methods inherited from class org.apache.derby.impl.io.InputStreamFile
canWrite, createNewFile, delete, deleteAll, equals, getCanonicalPath, getExclusiveFileLock, getName, getOutputStream, getOutputStream, getParentDir, getPath, getRandomAccessFile, hashCode, isDirectory, limitAccessToOwner, list, mkdir, mkdirs, releaseExclusiveFileLock, renameTo, setReadOnly, toString
-
Constructor Details
-
CPFile
CPFile(CPStorageFactory storageFactory, String path) -
CPFile
CPFile(CPStorageFactory storageFactory, String parent, String name) -
CPFile
-
CPFile
-
-
Method Details
-
exists
public boolean exists()Tests whether the named file exists.- Specified by:
exists
in interfaceStorageFile
- Specified by:
exists
in classInputStreamFile<CPStorageFactory>
- Returns:
- true if the named file exists, false if not.
-
getParentDir
Get the parent of this file.- Specified by:
getParentDir
in classInputStreamFile<CPStorageFactory>
- Parameters:
pathLen
- the length of the parent's path name.
-
getInputStream
Creates an input stream from a file name.- Specified by:
getInputStream
in interfaceStorageFile
- Specified by:
getInputStream
in classInputStreamFile<CPStorageFactory>
- Returns:
- an input stream suitable for reading from the file.
- Throws:
FileNotFoundException
- if the file is not found.
-
getURL
Return a URL for this file (resource). -
getContextClassLoader
Privileged wrapper forThread.getContextClassLoader()
. -
getResource
Privileged wrapper forClassLoader.getResource(String)
. -
getSystemResource
Privileged wrapper forClassLoader.getSystemResource(String)
. -
getResourceAsStream
Privileged wrapper forClassLoader.getResourceAsStream(String)
. -
getSystemResourceAsStream
Privileged wrapper forClassLoader.getSystemResourceAsStream(String)
.
-