com.caucho.vfs
Class JarPath

java.lang.Object
  extended by com.caucho.vfs.Path
      extended by com.caucho.vfs.FilesystemPath
          extended by com.caucho.vfs.JarPath
All Implemented Interfaces:
java.lang.Comparable<Path>

public class JarPath
extends FilesystemPath

A filesystem for .jar files.


Field Summary
 
Fields inherited from class com.caucho.vfs.FilesystemPath
_bindRoot, _pathname, _root, _userPath
 
Fields inherited from class com.caucho.vfs.Path
_pathSeparatorChar, _schemeMap, _separatorChar, L
 
Constructor Summary
protected JarPath(FilesystemPath root, java.lang.String userPath, java.lang.String path, Path backing)
          Creates a new jar path for the specific file
 
Method Summary
 boolean canRead()
          Tests if the file can be read.
 boolean canWrite()
          Tests if the file can be written.
 void closeJar()
           
static JarPath create(Path backing)
          Creates a new root Jar path.
 boolean equals(java.lang.Object o)
          Tests for equality.
 boolean exists()
          Returns true if the entry exists in the jar file.
 Path fsWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String path)
          Lookup a path relative to the current filesystem's root.
 java.security.cert.Certificate[] getCertificates()
          Returns any signing certificates.
 Path getContainer()
          Returns the underlying file below the jar.
 PersistentDependency getDepend()
          Returns the dependency checker from the jar.
 Jar getJar()
           
 long getLastModified()
          Returns the last modified time of the file.
 long getLength()
          Returns the length of the file in bytes.
 java.util.jar.Manifest getManifest()
          Returns the manifest.
 java.lang.String getScheme()
          Returns the scheme (jar)
 java.lang.String getURL()
          Returns the full url.
 int hashCode()
           
 boolean isDirectory()
          Returns true if the entry is a directory in the jar file.
 boolean isFile()
          Returns true if the entry is a file in the jar file.
 boolean isPathCacheable()
          Returns true if the path itself is cacheable
 java.lang.String[] list()
          Returns a list of the directories in the jar.
 StreamImpl openReadImpl()
           
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.vfs.FilesystemPath
bind, createRoot, getFullPath, getParent, getPath, getRoot, getTail, getUserPath, normalizePath, normalizePath, schemeWalk, setUserPath
 
Methods inherited from class com.caucho.vfs.Path
cacheCopy, canExecute, changeGroup, changeGroup, changeOwner, changeOwner, chmod, clearStatusCache, compareTo, copy, createDepend, createLink, createNewFile, createRoot, createTempFile, escapeURL, getAttribute, getAttributeNames, getBlockCount, getBlockSize, getCache, getContentType, getCrc64, getCreateTime, getDevice, getDeviceId, getDiskSpaceFree, getDiskSpaceTotal, getFileSeparatorChar, getGroup, getHost, getInode, getLastAccessTime, getLastStatusChangeTime, getMode, getNativePath, getNewlineString, getNumberOfLinks, getObject, getOwner, getPathSeparatorChar, getPort, getQuery, getRelativePath, getResources, getResources, getSchemeMap, getSeparatorChar, getUser, getUserDir, getValue, isBlockDevice, isCharacterDevice, isExecutable, isFIFO, isHardLink, isLink, isObject, isSocket, isSymbolicLink, isWindows, isWindowsInsecure, iterator, lookup, lookup, lookup, lookupImpl, lookupNative, lookupNative, lookupRelativeNativePath, mkdir, mkdirs, openAppend, openAppendImpl, openFileRandomAccess, openMemoryMappedFile, openRandomAccess, openRead, openReadWrite, openReadWrite, openReadWrite, openReadWriteImpl, openWrite, openWriteImpl, putCache, readLink, realPath, remove, removeAll, renameTo, renameTo, scanScheme, setDefaultSchemeMap, setExecutable, setLastModified, setObject, setTestWindows, setValue, truncate, truncate, unbind, writeToStream, writeToStream
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JarPath

protected JarPath(FilesystemPath root,
                  java.lang.String userPath,
                  java.lang.String path,
                  Path backing)
Creates a new jar path for the specific file

Parameters:
root - the root of this jar
userPath - the path specified by the user in the lookup()
path - the normalized path
jarFile - the underlying jar
Method Detail

create

public static JarPath create(Path backing)
Creates a new root Jar path.


fsWalk

public Path fsWalk(java.lang.String userPath,
                   java.util.Map<java.lang.String,java.lang.Object> attributes,
                   java.lang.String path)
Description copied from class: FilesystemPath
Lookup a path relative to the current filesystem's root. Filesystems will specialize fsWalk.

Specified by:
fsWalk in class FilesystemPath
Parameters:
userPath - the exact string passed by the user's lookup()
attributes - the user's new attributes
path - the normalized real path
Returns:
the matching path

getScheme

public java.lang.String getScheme()
Returns the scheme (jar)

Specified by:
getScheme in class Path

isPathCacheable

public boolean isPathCacheable()
Description copied from class: Path
Returns true if the path itself is cacheable

Overrides:
isPathCacheable in class Path

getURL

public java.lang.String getURL()
Returns the full url.

jar:!/entry-path

Overrides:
getURL in class Path

getContainer

public Path getContainer()
Returns the underlying file below the jar.


getCertificates

public java.security.cert.Certificate[] getCertificates()
Returns any signing certificates.

Overrides:
getCertificates in class Path

exists

public boolean exists()
Returns true if the entry exists in the jar file.

Overrides:
exists in class Path

isDirectory

public boolean isDirectory()
Returns true if the entry is a directory in the jar file.

Overrides:
isDirectory in class Path

isFile

public boolean isFile()
Returns true if the entry is a file in the jar file.

Overrides:
isFile in class Path

getLength

public long getLength()
Description copied from class: Path
Returns the length of the file in bytes.

Overrides:
getLength in class Path
Returns:
0 for non-files

getLastModified

public long getLastModified()
Description copied from class: Path
Returns the last modified time of the file. According to the jdk, this may not correspond to the system time.

Overrides:
getLastModified in class Path
Returns:
0 for non-files.

canRead

public boolean canRead()
Description copied from class: Path
Tests if the file can be read.

Overrides:
canRead in class Path

canWrite

public boolean canWrite()
Description copied from class: Path
Tests if the file can be written.

Overrides:
canWrite in class Path

list

public java.lang.String[] list()
                        throws java.io.IOException
Returns a list of the directories in the jar.

Overrides:
list in class Path
Returns:
The contents of this directory or null if the path does not refer to a directory.
Throws:
java.io.IOException

getManifest

public java.util.jar.Manifest getManifest()
                                   throws java.io.IOException
Returns the manifest.

Throws:
java.io.IOException

getDepend

public PersistentDependency getDepend()
Returns the dependency checker from the jar.


openReadImpl

public StreamImpl openReadImpl()
                        throws java.io.IOException
Overrides:
openReadImpl in class Path
Throws:
java.io.IOException

getJar

public Jar getJar()

closeJar

public void closeJar()

toString

public java.lang.String toString()
Overrides:
toString in class Path

hashCode

public int hashCode()
Overrides:
hashCode in class FilesystemPath

equals

public boolean equals(java.lang.Object o)
Tests for equality.

Overrides:
equals in class FilesystemPath