Package org.apache.derby.impl.io
Class CPFile
- java.lang.Object
-
- org.apache.derby.impl.io.InputStreamFile<CPStorageFactory>
-
- org.apache.derby.impl.io.CPFile
-
- All Implemented Interfaces:
StorageFile
class CPFile extends InputStreamFile<CPStorageFactory>
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
Constructors Modifier Constructor Description (package private)
CPFile(CPFile dir, java.lang.String name)
(package private)
CPFile(CPStorageFactory storageFactory, java.lang.String path)
private
CPFile(CPStorageFactory storageFactory, java.lang.String child, int pathLen)
(package private)
CPFile(CPStorageFactory storageFactory, java.lang.String parent, java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
exists()
Tests whether the named file exists.private static java.lang.ClassLoader
getContextClassLoader(java.lang.Thread thread)
Privileged wrapper forThread.getContextClassLoader()
.java.io.InputStream
getInputStream()
Creates an input stream from a file name.(package private) StorageFile
getParentDir(int pathLen)
Get the parent of this file.private static java.net.URL
getResource(java.lang.ClassLoader cl, java.lang.String name)
Privileged wrapper forClassLoader.getResource(String)
.private static java.io.InputStream
getResourceAsStream(java.lang.ClassLoader cl, java.lang.String name)
Privileged wrapper forClassLoader.getResourceAsStream(String)
.private static java.net.URL
getSystemResource(java.lang.String name)
Privileged wrapper forClassLoader.getSystemResource(String)
.private static java.io.InputStream
getSystemResourceAsStream(java.lang.String name)
Privileged wrapper forClassLoader.getSystemResourceAsStream(String)
.private java.net.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 Detail
-
CPFile
CPFile(CPStorageFactory storageFactory, java.lang.String path)
-
CPFile
CPFile(CPStorageFactory storageFactory, java.lang.String parent, java.lang.String name)
-
CPFile
CPFile(CPFile dir, java.lang.String name)
-
CPFile
private CPFile(CPStorageFactory storageFactory, java.lang.String child, int pathLen)
-
-
Method Detail
-
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
StorageFile getParentDir(int pathLen)
Get the parent of this file.- Specified by:
getParentDir
in classInputStreamFile<CPStorageFactory>
- Parameters:
pathLen
- the length of the parent's path name.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.FileNotFoundException
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:
java.io.FileNotFoundException
- if the file is not found.
-
getURL
private java.net.URL getURL()
Return a URL for this file (resource).
-
getContextClassLoader
private static java.lang.ClassLoader getContextClassLoader(java.lang.Thread thread)
Privileged wrapper forThread.getContextClassLoader()
.
-
getResource
private static java.net.URL getResource(java.lang.ClassLoader cl, java.lang.String name)
Privileged wrapper forClassLoader.getResource(String)
.
-
getSystemResource
private static java.net.URL getSystemResource(java.lang.String name)
Privileged wrapper forClassLoader.getSystemResource(String)
.
-
getResourceAsStream
private static java.io.InputStream getResourceAsStream(java.lang.ClassLoader cl, java.lang.String name)
Privileged wrapper forClassLoader.getResourceAsStream(String)
.
-
getSystemResourceAsStream
private static java.io.InputStream getSystemResourceAsStream(java.lang.String name)
Privileged wrapper forClassLoader.getSystemResourceAsStream(String)
.
-
-