public class TipURLFileSystemHelper extends URLFileSystemHelper
URLFileSystem operations
 associated with the "tip" protocol. This is a simple line-oriented text
 archive file (think text zip file). Directive lines begin with "###"; a directive line contains
 a directive name and zero or more arguments. An argument is of the form
 name = value; multiple arguments are separated by commas. Currently, two
 directives are supported:
 Based on JarURLFileSystemHelper. However, since it
 is currently only contemplated for use in setting up unit tests, the
 implementation is naive: the entire contents of each file in the archive
 is loaded into the index when the archive is first read.
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
PROTOCOL_NAME  | 
static java.lang.String | 
ROOT_SEPARATOR  | 
| Constructor and Description | 
|---|
TipURLFileSystemHelper()  | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
canCreate(java.net.URL url)
Tests whether the application can create the resource at the specified
  
URL. | 
java.net.URL | 
canonicalize(java.net.URL url)
Returns a canonical form of the  
URL, if one is available. | 
boolean | 
canRead(java.net.URL url)
Tests whether the application can read the resource at the
  specified  
URL. | 
boolean | 
canWrite(java.net.URL url)
Tests whether the application can modify the resource at the
  specified  
URL. | 
boolean | 
exists(java.net.URL url)
Returns  
true if the specified URL points to a
  resource that currently exists; returns false
  otherwise. | 
javax.swing.Icon | 
getDefaultIcon(java.net.URL url)
If this  
URL represents the root directory entry of a tip
 file, then returns a standard archive folder Icon; otherwise,
 returns the built-in icons for a file or directory. | 
java.lang.String | 
getFileName(java.net.URL url)
Returns the name of the file contained by the  
URL, not
  including any protocol, hostname authentication, directory path,
  anchor, or query. | 
long | 
getLength(java.net.URL url)
Returns the number of bytes contained in the resource that the
  specified  
URL points to. | 
java.net.URL | 
getParent(java.net.URL url)
Since tip  
URLs are compound, when you reach the root of
 the tip entry, you get a tip URL with an empty entry
 name. | 
java.lang.String | 
getPlatformPathName(java.net.URL url)
If this tip URL does not include an entry, then we can
 just return the platform path name for the tip file's URL. 
 | 
static java.lang.String | 
getTipEntryName(java.net.URL url)
Returns the jar entry name within the specified jar  
URL. | 
static java.net.URL | 
getTipRootUrl(java.net.URL url)
Returns the tip file part of the specified jar
  
URL. | 
boolean | 
isDirectory(java.net.URL url)
If the specified  
URL points to just the jar file
 and not to any particular entry within it, then this method
 will return true if the jar file exists. | 
static boolean | 
isTipUrl(java.net.URL url)
Returns  
true if the specified URL has
 the "jar" protocol. | 
long | 
lastModified(java.net.URL url)
Returns the last modification time (timestamp) of the resource
  indicated by the specified  
URL in milliseconds since
  00:00:00 GMT, Jan 1, 1970. | 
java.net.URL[] | 
list(java.net.URL url)
Returns an array of  
URLs naming files and directories in
  the directory indicated by the URL. | 
static java.net.URL | 
newTipUrl(java.net.URL url,
         java.lang.String entryName)  | 
java.io.InputStream | 
openInputStream(java.net.URL url)
Overrides default implemention to provide a more optimized way
 way of obtaining an input stream for a jar entry. 
 | 
void | 
rename(java.net.URL oldURL,
      java.net.URL newURL)
If both of the specified  
URL objects refer to just a jar
 file and not a particular entry within it, then the jar file
 itself is renamed. | 
java.lang.String | 
toRelativeSpec(java.net.URL url,
              java.net.URL base)
For the time being, there is no supported syntax for a relative
  
URL reference for a "jar" URL. | 
addURLFileSystemListener, appendRelativePath, areEqual, areEqualPathElems, canDelete, code, convertSuffix, createReader, createTempFile, delete, ensureSuffix, equals, getBaseParent, getName, getPath, getPathNoExt, getPort, getSuffix, getSystemDisplayName, getSystemIcon, getTempDirectory, hashCode, hasSuffix, haveSameAuthority, haveSameHost, haveSamePath, haveSamePort, haveSameProtocol, haveSameQuery, haveSameRef, haveSameUserInfo, isBaseURLFor, isDirectoryPath, isHidden, isLocal, isReadOnly, isRegularFile, isValid, list, list, listRoots, ls, ls, lsCached, lsCached, mkdir, mkdirs, openOutputStream, removeURLFileSystemListener, setLastModified, setReadOnly, toDisplayString, toEncodedString, toEncodedString, toRelativeSpec, verifyListpublic static final java.lang.String PROTOCOL_NAME
public static final java.lang.String ROOT_SEPARATOR
public java.net.URL canonicalize(java.net.URL url)
URLFileSystemHelperURL, if one is available.
  
  The default implementation just returns the specified URL
  as-is.
canonicalize in class URLFileSystemHelperpublic boolean canRead(java.net.URL url)
URLFileSystemHelperURL.canRead in class URLFileSystemHelpertrue if and only if the specified
  URL points to a resource that exists and can be
  read by the application; false otherwise.public boolean canWrite(java.net.URL url)
URLFileSystemHelperURL.canWrite in class URLFileSystemHelpertrue if and only if the specified
  URL points to a file that exists and the
  application is allowed to write to the file; false
  otherwise.public boolean canCreate(java.net.URL url)
URLFileSystemHelperURL.canCreate in class URLFileSystemHelpertrue if the resource at the specified URL
 exists or can be created; false otherwise.public boolean exists(java.net.URL url)
URLFileSystemHelpertrue if the specified URL points to a
  resource that currently exists; returns false
  otherwise.
  The default implementation simply returns false
  without doing anything.
exists in class URLFileSystemHelperpublic javax.swing.Icon getDefaultIcon(java.net.URL url)
URL represents the root directory entry of a tip
 file, then returns a standard archive folder Icon; otherwise,
 returns the built-in icons for a file or directory.getDefaultIcon in class URLFileSystemHelperURLFileSystemHelper.getSystemIcon(URL)public java.lang.String getFileName(java.net.URL url)
URLFileSystemHelperURL, not
  including any protocol, hostname authentication, directory path,
  anchor, or query.  This simply returns the simple filename.  For
  example, if you pass in an URL whose string representation
  is:
  
    protocol://host:1010/dir1/dir2/file.ext#anchor?query
  
  the returned value is "file.ext" (without the
  quotes).
  The returned file name should only be used for display purposes
  and not for opening streams or otherwise trying to locate the
  resource indicated by the URL.
getFileName in class URLFileSystemHelperpublic long getLength(java.net.URL url)
URLFileSystemHelperURL points to.  If the length cannot be
  determined, -1 is returned.
  The default implementation attempts to get the content length from
  the URLConnection associated with the URL.  If that
  fails for some reason (e.g. the resource does not exist, there was
  some other an I/O exception, etc.), -1 is returned.
getLength in class URLFileSystemHelperURLConnectionpublic java.net.URL getParent(java.net.URL url)
URLs are compound, when you reach the root of
 the tip entry, you get a tip URL with an empty entry
 name.  If you then get the parent of that, you will
 get the parent directory of the tip file itself, and the
 returned URL will no longer have the "tip" protocol.
 For example, the following sequence of URL strings
 represents an iterative sequence of calls to getParent:
 tip:file:/C:/jre-lib/rt.tip!/java/lang/Object.class
 tip:file:/C:/jre-lib/rt.tip!/java/lang/
 tip:file:/C:/jre-lib/rt.tip!/java/
 tip:file:/C:/jre-lib/rt.tip!/
 file:/C:/jre-lib/
 file:/C:/
 null
 getParent in class URLFileSystemHelperpublic java.lang.String getPlatformPathName(java.net.URL url)
getPlatformPathName in class URLFileSystemHelperURL in
  platform-dependent notation.  This value should only be used for
  display purposes and not for opening streams or otherwise trying
  to locate the document.public boolean isDirectory(java.net.URL url)
URL points to just the jar file
 and not to any particular entry within it, then this method
 will return true if the jar file exists.isDirectory in class URLFileSystemHelpertrue if and only if the location indicated
  by the URL exists and is a directory;
  false otherwise.public long lastModified(java.net.URL url)
URLFileSystemHelperURL in milliseconds since
  00:00:00 GMT, Jan 1, 1970.  If the timestamp can't be determined,
  -1 is returned.
  The default implementation attemps to get the last modified time
  from the URLConnection associated with the URL.  If
  that fails for some reason (e.g. the resource does not exist, there
  was some other I/O exception, etc.), -1 is returned.
lastModified in class URLFileSystemHelperURLConnectionpublic java.net.URL[] list(java.net.URL url)
URLFileSystemHelperURLs naming files and directories in
  the directory indicated by the URL.  If the specified
  URL does not represent a directory, then this method
  returns null.  Otherwise, an array of URLs
  is returned, one for each file or directory in the directory.
  URLs representing the directory itself or its parent are
  not included in the result.  There is no guarantee that the
  URLs will occur in any particular order.
  The default implementation always returns an empty URL
  array.
list in class URLFileSystemHelperURLs naming the files and directories
  in the directory indicated by the URL.  The array will
  be empty if the directory is empty.  Returns null
  if the URL does not represent a directory or if an
  I/O error occurs.public java.io.InputStream openInputStream(java.net.URL url)
                                    throws java.io.IOException
openInputStream in class URLFileSystemHelperInputStream for the specified jar entry.  If
 no such jar entry exists or if the URL points to the root of the
 JAR file, FileNotFoundException is thrown.java.io.FileNotFoundException - if the resource at the
  specified URL does not exist.java.io.IOException - if an I/O error occurs when trying to open
  the InputStream.java.net.UnknownServiceException - if the
  URLConnection backing the specified URL does not
  support an InputStream.IOException, 
URLConnection, 
UnknownServiceExceptionpublic void rename(java.net.URL oldURL,
                   java.net.URL newURL)
            throws java.io.IOException
URL objects refer to just a jar
 file and not a particular entry within it, then the jar file
 itself is renamed.  Otherwise, failure is returned, since we do
 not allow renaming an entry within a jar file.rename in class URLFileSystemHelperjava.io.IOException - if an I/O exception occurs while renaming
  the URL.URLFileSystem.renameTo(URL, URL), 
URLFileSystem.renameEx(URL, URL)public java.lang.String toRelativeSpec(java.net.URL url,
                                       java.net.URL base)
URL reference for a "jar" URL.  The reason for
 this is that the URL constructors that accept a context
 URL and a spec String do not handle "jar"
 URLs in the same way as other protocols.  For example,
 "../" sequences are not resolved in the same way.  Also relative
 "jar" references more than likely will need to be relative
 references to the jar file itself, rather than a relative reference
 to some path within the jar file, since everything in the jar file
 is already relative to the jar file.
 However, relative references for a jar URL are supported
 in the limited circumstance that both URLs refer to entries
 within the same jar file and the base entry contains the target
 URL entry.
toRelativeSpec in class URLFileSystemHelperpublic static boolean isTipUrl(java.net.URL url)
true if the specified URL has
 the "jar" protocol.  Returns false if the specified
 URL is null or has a protocol other than
 "jar".public static java.net.URL newTipUrl(java.net.URL url,
                                     java.lang.String entryName)
public static java.lang.String getTipEntryName(java.net.URL url)
URL.
 If the jar URL specifies no entry, then the empty string
 is returned.  If the URL is not a jar URL, then
 null is returned.public static java.net.URL getTipRootUrl(java.net.URL url)
URL.  The specified URL is returned if it
 is not a tip URL.