org.apache.derby.impl.io
Class JarDBFile

java.lang.Object
  extended by org.apache.derby.impl.io.InputStreamFile
      extended by org.apache.derby.impl.io.JarDBFile
All Implemented Interfaces:
StorageFile

 class JarDBFile
extends InputStreamFile

This class provides a jar file based implementation of the StorageFile interface. It is used by the database engine to access persistent data and transaction logs under the jar subsubprotocol.


Field Summary
private  JarStorageFactory storageFactory
           
 
Fields inherited from class org.apache.derby.impl.io.InputStreamFile
nameStart, path
 
Fields inherited from interface org.apache.derby.io.StorageFile
EXCLUSIVE_FILE_LOCK, EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE, NO_FILE_LOCK_SUPPORT
 
Constructor Summary
(package private) JarDBFile(JarDBFile dir, java.lang.String name)
           
(package private) JarDBFile(JarStorageFactory storageFactory, java.lang.String path)
           
private JarDBFile(JarStorageFactory storageFactory, java.lang.String child, int pathLen)
           
(package private) JarDBFile(JarStorageFactory storageFactory, java.lang.String parent, java.lang.String name)
           
 
Method Summary
 boolean exists()
          Tests whether the named file exists.
private  java.util.zip.ZipEntry getEntry()
           
 java.io.InputStream getInputStream()
          Creates an input stream from a file name.
(package private)  StorageFile getParentDir(int pathLen)
          Get the name of the parent directory if this name includes a parent.
 java.net.URL getURL()
          Return a URL for this file (resource).
 long length()
          Returns the length of the named file if it is not a directory.
 java.lang.String toString()
          Get the file name for diagnostic purposes.
 
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, list, mkdir, mkdirs, releaseExclusiveFileLock, renameTo, setReadOnly
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

storageFactory

private final JarStorageFactory storageFactory
Constructor Detail

JarDBFile

JarDBFile(JarStorageFactory storageFactory,
          java.lang.String path)

JarDBFile

JarDBFile(JarStorageFactory storageFactory,
          java.lang.String parent,
          java.lang.String name)

JarDBFile

JarDBFile(JarDBFile dir,
          java.lang.String name)

JarDBFile

private JarDBFile(JarStorageFactory storageFactory,
                  java.lang.String child,
                  int pathLen)
Method Detail

exists

public boolean exists()
Tests whether the named file exists.

Specified by:
exists in interface StorageFile
Specified by:
exists in class InputStreamFile
Returns:
true if the named file exists, false if not.

getEntry

private java.util.zip.ZipEntry getEntry()

length

public long length()
Returns the length of the named file if it is not a directory. The return value is not specified if the file is a directory.

Specified by:
length in interface StorageFile
Overrides:
length in class InputStreamFile
Returns:
The length, in bytes, of the named file if it exists and is not a directory, 0 if the file does not exist, or any value if the named file is a directory.

getParentDir

StorageFile getParentDir(int pathLen)
Get the name of the parent directory if this name includes a parent.

Specified by:
getParentDir in class InputStreamFile
Parameters:
pathLen - the length of the parent's path name.
Returns:
An StorageFile denoting the parent directory of this StorageFile, if it has a parent, null if it does not have a parent.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.FileNotFoundException
Creates an input stream from a file name.

Specified by:
getInputStream in interface StorageFile
Specified by:
getInputStream in class InputStreamFile
Returns:
an input stream suitable for reading from the file.
Throws:
java.io.FileNotFoundException - if the file is not found.

toString

public java.lang.String toString()
Get the file name for diagnostic purposes. Usually the same as getPath().

Overrides:
toString in class InputStreamFile
Returns:
the file name

getURL

public java.net.URL getURL()
                    throws java.net.MalformedURLException
Return a URL for this file (resource). Returns a URL according to the spec for java.net.JarURLConnection

Specified by:
getURL in interface StorageFile
Overrides:
getURL in class InputStreamFile
Throws:
java.net.MalformedURLException - File cannot be represented as a URL.
See Also:
StorageFile.getURL()

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.