|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.ide.net.URLFileSystem
public final class URLFileSystem
The URLFileSystem
class is responsible for encapsulating the notion of file system operations on content that is pointed to by an URL
.
The behavior of URLFileSystem
can be extended by subclasses of URLFileSystemHelper
. An instance of URLFileSystemHelper
is registered with URLFileSystem
in association with a particular protocol. Protocol-specific behavior can thus be encapsulated by a specific implementation of URLFileSystemHelper
.
Nested Class Summary | |
---|---|
static class |
URLFileSystem.FileInfo The FileInfo class encapsulates the information describing files returned by the ls(URL) and ls(URL, URLFilter) methods. |
Method Summary | |
---|---|
static void |
addExistsTest(URLExistsTest existsTest) Add an implementation of the URLExistsTest interface. |
static void |
addURLFileSystemListener(java.net.URL rootURL, URLFileSystemListener listener) Adds an URLFileSystemListener instance to track file changes in the given root URL directory. |
static void |
addURLStreamHandlerFactory(java.net.URLStreamHandlerFactory factory) Use this method to register additional instances of URLStreamHandlerFactory that should be used by the IDE when dealing with URL s. |
static boolean |
canCreate(java.net.URL url) Tests whether the application can create the resource at the specified URL . |
static boolean |
canDelete(java.net.URL url) Tests whether the application can delete the resource at the specified URL . |
static java.net.URL |
canonicalize(java.net.URL url) Returns a canonical form of the URL , if one is available. |
static boolean |
canRead(java.net.URL url) Tests whether the application can read the resource at the specified URL . |
static boolean |
canWrite(java.net.URL url) Tests whether the application can modify the resource at the specified URL . |
static java.net.URL |
convertSuffix(java.net.URL url, java.lang.String oldSuffix, java.lang.String newSuffix) Takes the given URL and checks if its URL.toString() representation ends with the specified oldSuffix . |
static void |
copy(java.io.InputStream in, java.net.URL dst) Copies the contents of in to dst . |
static void |
copy(java.net.URL src, java.io.File dst) Copies the contents at src to dst . |
static void |
copy(java.net.URL src, java.net.URL dst) Copies the contents at src to dst . |
static java.io.Reader |
createReader(java.net.URL url, java.lang.String encoding) |
static java.net.URL |
createTempFile(java.lang.String prefix, java.lang.String suffix, java.net.URL directory) Creates a new empty temporary file in the specified directory using the given prefix and suffix strings to generate its name. |
static boolean |
delete(java.net.URL url) Deletes the content pointed to by the specified URL . |
static void |
deleteEx(java.net.URL url) Deletes the content pointed to by the specified URL . |
static java.net.URL |
ensureSuffix(java.net.URL url, java.lang.String suffix) This method ensures that the specified URL ends with the specified suffix . |
static boolean |
equals(java.net.URL url1, java.net.URL url2) Returns true if both of the specified URL parameters point to the same URL object or if the both URL parameters have the same protocol and the protocol helper determines that the URL objects are equal. |
static boolean |
exists(java.net.URL url) Tests whether a resource at the specified URL location currently exists. |
static URLFileSystemHelper |
findHelper(java.lang.String protocol) Returns the URLFileSystemHelper class that is currently registered to handle operations related to the specified protocol . |
static URLFileSystemHelper |
findHelper(java.net.URL url) Returns the URLFileSystemHelper class that is currently registered to handle operations related to the specified URL . |
protected static void |
fireRenameURLFileSystemEvent(java.net.URL newURL, java.net.URL oldURL, int eventType) Utility routine which will take care of firing the URLFileSystemEvent as specified. |
protected static void |
fireURLFileSystemEvent(java.net.URL changedURL, int eventType) Utility routine which will take care of firing the URLFileSystemEvent as specified. |
static java.net.URL |
getBaseParent(java.net.URL url, java.lang.String relativeSpec) |
static javax.swing.Icon |
getDefaultIcon(java.net.URL url) Returns a standard Icon that can be used to represent the resource designated by the specified URL . |
static 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. |
static long |
getLength(java.net.URL url) Returns the size in bytes of the content pointed to by the specified URL . |
protected static java.util.Map<URLFileSystemListener,java.util.List<java.net.URL>> |
getListenersAndTrackedRootURLs(java.util.Collection<java.net.URL> rootURLs) Fetch all the URLFileSystemListeners which track any of the specify root URLs. |
static java.lang.String |
getName(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. |
protected static java.util.List<java.net.URL> |
getNonExistentParents(java.net.URL rootURL, java.net.URL url) Utility routine to get the intermediate parents of url, up to, and including the rootURL that might not currently exist. |
static java.net.URL |
getParent(java.net.URL url) Returns the URL representing the parent directory of the specified URL . |
static java.lang.String |
getPath(java.net.URL url) Returns the path part of the URL . |
static java.lang.String |
getPathNoExt(java.net.URL url) Returns the path part of the URL without the last file extension. |
static java.lang.String |
getPlatformPathName(java.net.URL url) Returns the platform-dependent String representation of the URL ; the returned string should be considered acceptable for users to read. |
static java.lang.String |
getSuffix(java.net.URL url) If a dot ('.') occurs in the file name of the path portion of the URL , then all of the text starting at the last dot is returned, including the dot. |
static java.lang.String |
getSystemDisplayName(java.net.URL url) Returns the name of a resource as it would be displayed in a system file browser. |
static javax.swing.Icon |
getSystemIcon(java.net.URL url) Returns the Icon used by the operating system to represent the resource designated by the specified URL ; if an Icon cannot be obtained from the operating system, then returns a standard Icon representing a file or folder, as appropriate. |
static java.io.File |
getTempDirectory(java.net.URL url) Returns a temporal directory suitable for URLs whose protocol matches the one found in the specified URL .If not match is found then the default temporal directory as specified by System.getProperty("java.io.tmpdir") will be returned. |
protected static java.net.URL |
getTrackedRootURL(java.net.URL url) Fetches the root URL that is being tracked (if any) that contains the specified url. |
protected static java.util.List<java.net.URL> |
getTrackedRootURLs(java.net.URL url) Fetch all root URLs that match the given URL. |
static java.util.Collection<java.net.URL> |
getURLsForListener(URLFileSystemListener listener) Fetch the root URLs that are being tracked by the given listener instance. |
static int |
hashCode(java.net.URL url) Returns a hash code for the specified URL consistent with equals(URL,URL) . |
protected static boolean |
hasListener(java.net.URL url) Gets whether any listeners are registered for a URL. |
static boolean |
hasSuffix(java.net.URL url, java.lang.String suffix) Returns true if the path part of the URL ends with the given suffix String. |
static boolean |
hasSuffix(java.net.URL url, java.lang.String[] suffixes) Returns true if the path part of the URL ends with any of the given suffixs String. |
static 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. |
static boolean |
isBound(java.net.URL url) This method tests whether the specified URL is bound to an existing resource, which may reside in memory (i.e. |
static boolean |
isDirectory(java.net.URL url) Tests whether the location indicated by the URL is a directory. |
static boolean |
isDirectoryPath(java.net.URL url) Tests whether the location indicated by the URL represents a directory path. |
static boolean |
isHidden(java.net.URL url) Tests whether the resource indiciated by the URL is a hidden file. |
static boolean |
isLocal(java.net.URL url) Determines whether the URL points to a resource on the local machine, or whether it requires network access. |
static boolean |
isLocalFileSystemCaseSensitive() Returns true if the local file system is case sensitive. |
static boolean |
isReadOnly(java.net.URL url) Returns true if the resource pointed to by the specified URL is read-only; returns false otherwise. |
static boolean |
isRegularFile(java.net.URL url) Tests whether the resource indiciated by the URL is a regular file. |
static boolean |
isRoot(java.net.URL url) Returns true if the specified URL corresponds to a root file system; false otherwise. |
static boolean |
isValid(java.net.URL url) Tests whether the specified URL is valid. |
static long |
lastModified(java.net.URL url) Returns the last modified time of the resource pointed to by the URL . |
static java.net.URL[] |
list(java.net.URL url) Returns an array of URL s naming files and directories in the directory indicated by the URL . |
static java.net.URL[] |
list(java.net.URL url, URLFilenameFilter filter) Returns an aray of URL s naming files and directories in the directory indicated by the URL . |
static java.net.URL[] |
list(java.net.URL url, URLFilter filter) Returns an array of URL s naming files and directories in the directory indicated by the URL ; the specified URLFilter is applied to determine which URL s will be returned. |
static java.net.URL[] |
listRoots() Returns an array of URL s that represent the root file systems that are currently available. |
static URLFileSystem.FileInfo[] |
ls(java.net.URL url) |
static URLFileSystem.FileInfo[] |
ls(java.net.URL url, URLFilter filter) |
static URLFileSystem.FileInfo[] |
lsCached(java.net.URL url) |
static URLFileSystem.FileInfo[] |
lsCached(java.net.URL url, URLFilter filter) |
static boolean |
mkdir(java.net.URL url) Creates the directory indicated by the URL . |
static boolean |
mkdirs(java.net.URL url) Creates the directory indicated by the specified URL including any necessary but nonexistent parent directories. |
protected static void |
notifyExistentParents(java.net.URL rootURL, java.util.List<java.net.URL> nonexistentParents) Deprecated. |
protected static void |
notifyNonexistentParents(java.util.List<java.net.URL> nonexistentParents) Utility routine to check if the given list of directories exist or not, and to fire events for them to notify clients that they had gotten created. |
static java.io.InputStream |
openInputStream(java.net.URL url) Opens an InputStream for the location indicated by the specified URL . |
static java.io.OutputStream |
openOutputStream(java.net.URL url) Opens an OutputStream for the location indicated by the specified URL . |
static void |
registerHelper(java.lang.String protocol, URLFileSystemHelper helper) Registers the specified URLFileSystemHelper as the object that can handle URLFileSystem operations for URL s of the specified protocol . |
static void |
removeURLFileSystemListener(java.net.URL rootURL, URLFileSystemListener listener) Removes an URLFileSystemListener instance from the given tracked root URL. |
static void |
renameEx(java.net.URL oldURL, java.net.URL newURL) |
static boolean |
renameTo(java.net.URL oldURL, java.net.URL newURL) Renames the resource indicated by the first URL to the name indicated by the second URL . |
static boolean |
setLastModified(java.net.URL url, long time) Sets the last-modified timestamp of the resource indicated by the URL to the time specified by time . |
static boolean |
setReadOnly(java.net.URL url, boolean readOnly) Sets the read-only status of the resource indicated by the URL according to the specified readOnly flag. |
static java.lang.String |
toDisplayString(java.net.URL url) Returns a user-displayable form of the specified URL . |
static java.lang.String |
toEncodedString(java.net.URL url) Returns a String representing the URL-encoded form of the specified URL . |
static java.lang.String |
toEncodedString(java.net.URL url, java.lang.String encoding) |
static java.lang.String |
toRelativeSpec(java.net.URL url, java.net.URL base) |
static java.lang.String |
toRelativeSpec(java.net.URL url, java.net.URL base, boolean mustConsumeBase) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void registerHelper(java.lang.String protocol, URLFileSystemHelper helper)
URLFileSystemHelper
as the object that can handle URLFileSystem
operations for URL
s of the specified protocol
.
If the protocol
is null
or the empty string or if helper
is null
, this method does nothing.
public static URLFileSystemHelper findHelper(java.lang.String protocol)
URLFileSystemHelper
class that is currently registered to handle operations related to the specified protocol
. If there is no registered helper, then a default helper is returned that can produce a default result.public static URLFileSystemHelper findHelper(java.net.URL url)
URLFileSystemHelper
class that is currently registered to handle operations related to the specified URL
. If there is no registered helper, then a default helper is returned that can produce a default result.public static void addExistsTest(URLExistsTest existsTest)
URLExistsTest
interface. The existsTest
object will be called by the isBound()
method to determine if an URL
is unique.public static void addURLStreamHandlerFactory(java.net.URLStreamHandlerFactory factory)
URLStreamHandlerFactory
that should be used by the IDE when dealing with URL
s. This allows multiple factories to be used instead of just a single factory as required by URL
. The factories are chained together in the order in which they are registered, which means that earlier factories get the first crack at handling an URL
.public static java.net.URL canonicalize(java.net.URL url)
URL
, if one is available.public static boolean canRead(java.net.URL url)
URL
.true
if and only if the specified URL
points to a resource that exists and can be read by the application; false
otherwise.public static boolean canWrite(java.net.URL url)
URL
.true
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 static boolean canCreate(java.net.URL url)
URL
. This method tests that all components of the path can be created. If the resource pointed by the URL
is read-only, this method returns false
.true
if the resource at the specified URL
exists or can be created; false
otherwise.public static boolean canDelete(java.net.URL url)
URL
. If source control integration is enabled, this method will return true
if the specified URL is under source control. Otherwise, if there is no source control integration enabled or if the URL is not under source control, then this method will return true
if the URL is not read-only or false
if the URL is read-only. If the URL does not exist, this method returns false
.url
- The URL
being checked whether it can be deleted.true
if the resource at the specified URL
exists and is either not read-only or is under source control; false
otherwise.public static boolean isValid(java.net.URL url)
URL
is valid. If the resource pointed by the URL
exists the method returns true
. If the resource does not exist, the method tests that all components of the path can be created.true
if the URL
is valid.public static java.net.URL convertSuffix(java.net.URL url, java.lang.String oldSuffix, java.lang.String newSuffix)
URL
and checks if its URL.toString()
representation ends with the specified oldSuffix
. If it does, the suffix is replaced with newSuffix
. Both suffix parameters must include the leading dot ('.') if the dot is part of the suffix. If the specified URL
does not end with the oldSuffix
, then the newSuffix
is simply appended to the end of the original URL
.public static void copy(java.net.URL src, java.net.URL dst) throws java.io.IOException
src
to dst
. If the destination directory does not exist, it will be created. IOException is throw if: - failed to read the source contents - failed to create destination directory - failed to write source contents to the destination filejava.io.IOException
public static void copy(java.io.InputStream in, java.net.URL dst) throws java.io.IOException
in
to dst
.java.io.IOException
public static void copy(java.net.URL src, java.io.File dst) throws java.io.IOException
src
to dst
.java.io.IOException
public static boolean delete(java.net.URL url)
URL
. If the content is a file (or analogous to a file), then the file is removed from its directory (or container). If the content is a directory (or analogous to a directory), then the directory is removed only if it is empty (i.e. contains no other files or directories).
To receive an IOException on deletion failure instead, use the deleteEx(URL)
method.
true
if and only if the file or directory is successfully deleted; false
otherwise.public static void deleteEx(java.net.URL url) throws java.io.IOException
URL
. If the content is a file (or analogous to a file), then the file is removed from its directory (or container). If the content is a directory (or analogous to a directory), then the directory is removed only if it is empty (i.e. contains no other files or directories).java.io.IOException
- if an I/O exception occurred while trying to delete the URL
. The exception message will contain details on why the deletion failed.public static java.net.URL ensureSuffix(java.net.URL url, java.lang.String suffix)
URL
ends with the specified suffix
. The suffix does not necessarily have to start with a ".", so if a leading "." is required, the specified suffix must contain it -- e.g. ".java", ".class".
If the URL
already ends in the specified suffix, then the URL
itself is returned. Otherwise, a new URL
is created with the the specified suffix appended to the original URL
's path part, and the new URL
is returned.
URL
, based on the specified URL
, whose path part ends with the specified suffix.java.lang.NullPointerException
- if either the specified URL
or suffix
is null
. The caller is responsible for checking that they are not null
.public static boolean equals(java.net.URL url1, java.net.URL url2)
true
if both of the specified URL
parameters point to the same URL
object or if the both URL
parameters have the same protocol and the protocol helper determines that the URL
objects are equal.public static int hashCode(java.net.URL url)
URL
consistent with equals(URL,URL)
.public static boolean exists(java.net.URL url)
URL
location currently exists. The test for existence only checks the actual location and does not check any in-memory caches. To employ additional existential tests that do check in-memory caches, see isBound(URL)
.true
if and only if a resource already exists at the specified URL
location; false
otherwise.public static javax.swing.Icon getDefaultIcon(java.net.URL url)
Icon
that can be used to represent the resource designated by the specified URL
.getSystemIcon(URL)
public static java.lang.String getFileName(java.net.URL url)
URL
, 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).URL
. This value should only be used for display purposes and not for opening streams or otherwise trying to locate the document.public static long getLength(java.net.URL url)
URL
.URL
.public static java.lang.String getName(java.net.URL url)
URL
, 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.ext1.ext2#anchor?query
the returned value is "file.ext1
" (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
.
The default implementation first calls getFileName(URL)
to get the file name part. Then all characters starting with the last occurrence of '.' are removed. The remaining string is then returned.
Note: The implementation of this method changed in the 11.1.1 release of the platform to trim the filename on the last '.'. In previous releases of the platform, it would trim the filename on the first '.'.
public static java.net.URL getParent(java.net.URL url)
URL
representing the parent directory of the specified URL
. If there is no parent directory, then null
is returned.public static java.lang.String getPath(java.net.URL url)
URL
. The returned string is acceptable to use in one of the URLFactory
methods that takes a path.
The default implementation delegates to URL.getPath()
.
public static java.lang.String getPathNoExt(java.net.URL url)
URL
without the last file extension. To clarify, the following examples demonstrate the different cases that come up:
URL |
String |
/dir/file.ext |
/dir/file |
/dir/file.ext1.ext2 |
/dir/file.ext1 |
/dir1.ext1/dir2.ext2/file.ext1.ext2 |
/dir1.ext1/dir2.ext2/file.ext1 |
/file.ext |
/file |
/dir.ext/file |
/dir.ext/file |
/dir/file |
/dir/file |
/file |
/file |
/.ext |
/ |
public static java.lang.String getPlatformPathName(java.net.URL url)
URL
; the returned string should be considered acceptable for users to read. In general, the returned string should omit as many parts of the URL
as possible. For the "file" protocol, therefore, the platform pathname should just be the pathname alone (no protocol) using the appropriate file separator character for the current platform. For other protocols, it may be necessary to reformat the URL
string into a more human-readable form. That decision is left to each URLFileSystemHelper
implementor.URL
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 static java.lang.String getSuffix(java.net.URL url)
URL
, then all of the text starting at the last dot is returned, including the dot. If the last dot is also the last character in the path, then the dot by itself is returned. If there is no dot in the file name (even if a dot occurs elsewhere in the path), then the empty string is returned.
Examples:
public static java.lang.String getSystemDisplayName(java.net.URL url)
getSystemIcon(URL)
public static javax.swing.Icon getSystemIcon(java.net.URL url)
Icon
used by the operating system to represent the resource designated by the specified URL
; if an Icon
cannot be obtained from the operating system, then returns a standard Icon
representing a file or folder, as appropriate.getDefaultIcon(URL)
, getSystemDisplayName(URL)
public static boolean hasSuffix(java.net.URL url, java.lang.String suffix)
true
if the path part of the URL
ends with the given suffix
String. The suffix can be any String and doesn't necessarily have to be one that begins with a dot ('.'). If you are trying to test whether the path part of the URL
ends with a particular file extension, then the suffix
parameter must begin with a '.' character to ensure that you get the right return value.public static boolean hasSuffix(java.net.URL url, java.lang.String[] suffixes)
true
if the path part of the URL
ends with any of the given suffixs
String. The suffixs can be any String and doesn't necessarily have to be one that begins with a dot ('.'). If you are trying to test whether the path part of the URL
ends with a particular file extension, then the suffixs
parameter must begin with a '.' character to ensure that you get the right return value.public static boolean isBaseURLFor(java.net.URL url1, java.net.URL url2)
true
if url1
represents a a directory and url2
points to a location within url1
's directory tree.public static boolean isBound(java.net.URL url)
URL
is bound to an existing resource, which may reside in memory (i.e. not yet saved) or already exist at the URL
location. This is similar to exists(URL)
but differs in that additional tests are applied that check whether the URL
is bound to an in-memory object before the actual URL
location is checked.
More precisely, "bound" means either that an URL
is being used in such a way that a registered URLExistsTest
is able to detect the URL
's usage or that a document already exists at the URL
location as determined by exists(URL)
).
Checking for uniqueness of a newly generated URL
is the primary use for this method.
public static boolean isLocal(java.net.URL url)
URL
points to a resource on the local machine, or whether it requires network access.url
- the URLtrue
if the URL
is local, false
if it requires network accesspublic static boolean isLocalFileSystemCaseSensitive()
true
if the local file system is case sensitive. Returns false
if the local file system is not case sensitive.public static boolean isDirectory(java.net.URL url)
URL
is a directory.true
if and only if the location indicated by the URL
exists and is a directory; false
otherwise.public static boolean isDirectoryPath(java.net.URL url)
URL
represents a directory path. The directory path specified by the URL
need not exist.
This method is intended to be a higher performance version of the isDirectory(URL)
method. Implementations of this method should attempt to ascertain whether the specified URL
represents a directory path by simply examining the URL
itself. Time consuming i/o operations should be avoided.
true
if the location indicated by the URL
represents a directory path; the directory path need not exist.public static boolean isHidden(java.net.URL url)
URL
is a hidden file. The exact definition of hidden is protocol-dependent and possibly system-dependent. On UNIX systems, a file is considered to be hidden if its name begins with a period character ('.'). On Win32 systems, a file is considered to be hidden if it has been marked as such in the file system.public static boolean isReadOnly(java.net.URL url)
true
if the resource pointed to by the specified URL
is read-only; returns false
otherwise. If the read-only status cannot be determined for some reason, this method returns true
.true
if the document pointed to by the specified URL
is read-only or if the read-only status cannot be determined; false
otherwise.public static boolean isRegularFile(java.net.URL url)
URL
is a regular file. A regular is a file that is not a directory and, in addition, satisfies other system-dependent criteria.true
if and only if the resource indicated by the URL
exists and is a normal file.public static boolean isRoot(java.net.URL url)
true
if the specified URL
corresponds to a root file system; false
otherwise.public static java.net.URL[] listRoots()
URL
s that represent the root file systems that are currently available. The determination of the roots is delegated to each registered URLFileSystemHelper
.public static long lastModified(java.net.URL url)
URL
. The returned long
is the number of milliseconds since the epoch (00:00:00 GMT Jan 1, 1970). If no timestamp is available or if the URL
passed in is null
, -1
is returned.URL
.public static java.net.URL[] list(java.net.URL url)
URL
s 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 URL
s is returned, one for each file or directory in the directory. URL
s representing the directory itself or its parent are not included in the result. There is no guarantee that the URL
s will occur in any particular order.URL
s 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 static java.net.URL[] list(java.net.URL url, URLFilter filter)
URL
s naming files and directories in the directory indicated by the URL
; the specified URLFilter
is applied to determine which URL
s will be returned. If the specified URL
does not represent a directory, then this method returns null
. Otherwise, an array of URL
s is returned, one for each file or directory in the directory that is accepted by the specified filter. URL
s representing the directory itself or its parent are not included in the result. There is no guarantee that the URL
s will occur in any particular order.
If the specified URLFilter
is null
then no filtering behavior is done.
URL
s naming the files and directories in the directory indicated by the URL
that are accepted by the specified URLFilter
. 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 static java.net.URL[] list(java.net.URL url, URLFilenameFilter filter)
URL
s naming files and directories in the directory indicated by the URL
. The specified URLFilenameFilter
is applied to determine which URL
s will be returned.
This method has better performance characteristics for some protocols than list(URL,URLFilter)
if you are able to filter out URLs based only on their name, because helpers may be able to avoid IO on children of the directory url.
url
- a directory URL to list. Must be a directory URL, and must not be null.filter
- a filter implementation. May be null, in which case this method behaves exactly like list(URL)
.URL
s naming the files and directories in the directory indicated by the URL
that are accepted by the specified URLFilenameFilter
. The array will be empty if the directory is empty. Returns null if an IO error occurs.java.lang.NullPointerException
- if the specified url is null.public static URLFileSystem.FileInfo[] ls(java.net.URL url)
URLFileSystemHelper.ls(URL)
public static URLFileSystem.FileInfo[] ls(java.net.URL url, URLFilter filter)
URLFileSystemHelper.ls(URL, URLFilter)
public static URLFileSystem.FileInfo[] lsCached(java.net.URL url)
URLFileSystemHelper.ls(URL)
public static URLFileSystem.FileInfo[] lsCached(java.net.URL url, URLFilter filter)
URLFileSystemHelper.ls(URL, URLFilter)
public static boolean mkdir(java.net.URL url)
URL
.true
if and only if the directory was created; false
otherwise.public static boolean mkdirs(java.net.URL url)
URL
including any necessary but nonexistent parent directories. Note that if this operation fails, it may have succeeded in creating some of the necessary parent directories. This method returns true
if the directory was created along with all necessary parent directories or if the directories already exist; it returns false
otherwise.true
if all directories were created successfully or exist; false
if there was a failure somewhere. Note that even if false
is returned, some directories may still have been created.public static java.net.URL createTempFile(java.lang.String prefix, java.lang.String suffix, java.net.URL directory) throws java.io.IOException
prefix
- The prefix string to be used in generating the file's name; must be at least three characters longsuffix
- The directory in which the file is to be created, or null if the default temporary-file directory is to be useddirectory
- The directory in which the file is to be created, or null if the default temporary-file directory is to be usedURL
to the temporary file.java.io.IOException
public static java.io.InputStream openInputStream(java.net.URL url) throws java.io.IOException
InputStream
for the location indicated by the specified URL
.url
- An InputStream
is opened on the given URL
. Depending on the protocol of the URL
, this method may delegate to an URLFileSystemHelper
or attempt to open the default InputStream
through the URL
's associated URLConnection
.InputStream
associated with the URL
.java.io.FileNotFoundException
- if the resource at the specified URL does not exist.java.io.IOException
- if an I/O error occurs while creating the input stream.java.net.UnknownServiceException
- (a runtime exception) if the associated URLConnection.getInputStream()
implementation does not support an InputStream
.public static java.io.OutputStream openOutputStream(java.net.URL url) throws java.io.IOException
OutputStream
for the location indicated by the specified URL
.url
- An OutputStream
is opened on the given URL
. Depending on the protocol of the URL
, this method may delegate to an URLFileSystemHelper
or attempt to open the default OutputStream
through the URL
's associated URLConnection
.OutputStream
associated with the URL
.java.io.IOException
- if an I/O error occurs while creating the output stream.java.net.UnknownServiceException
- (a runtime exception) if the associated URLConnection.getOutputStream()
implementation does not support an OutputStream
.public static boolean renameTo(java.net.URL oldURL, java.net.URL newURL)
URL
to the name indicated by the second URL
.
If either URL
parameter is null
or if both of the specified URL
parameters refer to the same resource, then the rename is not attempted and failure is returned.
If the specified URL
parameters do not have the same protocol, then the URLFileSystem
handles the rename by first copying the resource to the destination with copy(URL, URL)
and then deleting the original resource with delete(URL)
; if either operation fails, then failure is returned.
Otherwise, the protocol helper is called to perform the actual rename operation. Protocol helper implementations may therefore assume that both URL
parameters are not null
, do not refer to the same resource, and have the same protocol.
If the original URL
refers to a nonexistent resource, then the protocol helper implementations should return failure. It is left up to the protocol helper implementations to decide whether to overwrite the destination or return failure if the destination URL
refers to an existing resource.
oldURL
- the URL
of the original resourcenewURL
- the desired URL
for the renamed resourcetrue
if and only if the resource is successfully renamed; false
otherwise.public static void renameEx(java.net.URL oldURL, java.net.URL newURL) throws java.io.IOException
java.io.IOException
public static boolean setLastModified(java.net.URL url, long time)
URL
to the time specified by time
. The time is specified in the number of milliseconds since the epoch (00:00:00 GMT Jan 1, 1970). The return value indicates whether or not the setting of the timestamp succeeded.public static boolean setReadOnly(java.net.URL url, boolean readOnly)
URL
according to the specified readOnly
flag. The return value indicates whether or not the setting of the read-only flag succeeded.public static java.lang.String toDisplayString(java.net.URL url)
URL
.public static java.lang.String toEncodedString(java.net.URL url)
URL
.public static java.lang.String toEncodedString(java.net.URL url, java.lang.String encoding)
public static java.lang.String toRelativeSpec(java.net.URL url, java.net.URL base)
URLFileSystemHelper.toRelativeSpec(URL, URL)
public static java.lang.String toRelativeSpec(java.net.URL url, java.net.URL base, boolean mustConsumeBase)
URLFileSystemHelper.toRelativeSpec(URL, URL, boolean)
public static java.net.URL getBaseParent(java.net.URL url, java.lang.String relativeSpec)
URLFileSystemHelper.getBaseParent(URL, String)
public static java.io.Reader createReader(java.net.URL url, java.lang.String encoding) throws java.io.IOException
java.io.IOException
URLFileSystemHelper.createReader(URL, String)
protected static void fireURLFileSystemEvent(java.net.URL changedURL, int eventType)
URLFileSystemEvent
as specified.changedURL
- the URL that was affectedeventType
- the event that describing how the URL was affectedprotected static void fireRenameURLFileSystemEvent(java.net.URL newURL, java.net.URL oldURL, int eventType)
URLFileSystemEvent
as specified. This is for a rename type event.newURL
- the new URL that was affectedoldURL
- the old URL that was affectedeventType
- the event that describing how the URL was affectedprotected static boolean hasListener(java.net.URL url)
protected static java.net.URL getTrackedRootURL(java.net.URL url)
URLFileSystemListener
such that URLFileSystem.isBaseURLFor( rootURL, url )
returns true
.url
- the URL for which we want to locate a tracked root URLprotected static java.util.Map<URLFileSystemListener,java.util.List<java.net.URL>> getListenersAndTrackedRootURLs(java.util.Collection<java.net.URL> rootURLs)
protected static java.util.List<java.net.URL> getTrackedRootURLs(java.net.URL url)
protected static java.util.List<java.net.URL> getNonExistentParents(java.net.URL rootURL, java.net.URL url)
protected static void notifyNonexistentParents(java.util.List<java.net.URL> nonexistentParents)
getNonExistentParents( rootURL, url )
.
@Deprecated
protected static void notifyExistentParents(java.net.URL rootURL,
java.util.List<java.net.URL> nonexistentParents)
public static void addURLFileSystemListener(java.net.URL rootURL, URLFileSystemListener listener)
URLFileSystemListener
instance to track file changes in the given root URL directory. If the listener instance is already registered for the given root URL, then nothing happens.rootURL
- the root URL in which to track file changes such as file add, change, or remove eventslistener
- the listener instance to registerpublic static void removeURLFileSystemListener(java.net.URL rootURL, URLFileSystemListener listener)
URLFileSystemListener
instance from the given tracked root URL. If the listener instance is not currently registered for the given root URL, then nothing happens.rootURL
- the root URL in which to no longer track file changes for the given listenerlistener
- the listener instance to de-registerpublic static java.util.Collection<java.net.URL> getURLsForListener(URLFileSystemListener listener)
Collection
.listener
- the listener for which we want to fetch the registered root URL instancespublic static java.io.File getTempDirectory(java.net.URL url)
URL
.File
, based on the specified URL
, whose protocol matches the one found in the specified URL
.
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |