|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.3.0) E17493-04 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.ide.net.URLFileSystemHelper
oracle.ide.net.JarURLFileSystemHelper
public class JarURLFileSystemHelper
This class handles the URLFileSystem operations associated with the "jar" protocol.
| Constructor Summary | |
|---|---|
JarURLFileSystemHelper() |
|
| Method Summary | |
|---|---|
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 jar 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 jar URLs are compound, when you reach the root of the jar entry, you get a jar URL with an empty entry name. |
java.lang.String |
getPlatformPathName(java.net.URL url)If this jar URL does not include a JarEntry bit, then we can just return the platform path name for the jar file's URL. |
boolean |
isBaseURLFor(java.net.URL url1, java.net.URL url2)Returns true if url1 represents a a directory and url2 points to a location within url1's directory tree. |
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. |
boolean |
isLocal(java.net.URL url)Determines whether the URL points to a resource on the local machine, or whether it requires network access. |
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. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JarURLFileSystemHelper()
| Method Detail |
|---|
public boolean isBaseURLFor(java.net.URL url1,
java.net.URL url2)
URLFileSystemHelpertrue if url1 represents a a directory and url2 points to a location within url1's directory tree.isBaseURLFor in class URLFileSystemHelperpublic 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 jar 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 jar entry, you get a jar URL with an empty entry name. If you then get the parent of that, you will get the parent directory of the jar file itself, and the returned URL will no longer have the "jar" protocol. For example, the following sequence of URL strings represents an iterative sequence of calls to getParent:
jar:file:/C:/jre-lib/rt.jar!/java/lang/Object.classjar:file:/C:/jre-lib/rt.jar!/java/lang/jar:file:/C:/jre-lib/rt.jar!/java/jar:file:/C:/jre-lib/rt.jar!/file:/C:/jre-lib/file:/C:/nullgetParent 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 boolean isLocal(java.net.URL url)
URLFileSystemHelperURL points to a resource on the local machine, or whether it requires network access.isLocal in class URLFileSystemHelperurl - the URLtrue if the URL is local, false if it requires network accesspublic 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, UnknownServiceException
public 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 URLFileSystemHelper
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.3.0) E17493-04 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||