Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.9.0)

E52944-01


javax.ide.net
Class VirtualFileSystem

java.lang.Object
  extended by javax.ide.Service
      extended by javax.ide.net.VirtualFileSystem


public class VirtualFileSystem
extends Service

The VirtualFileSystem class is responsible for encapsulating the notion of file system operations on content that is pointed to by an URI.

The behavior of VirtualFileSystem can be extended by subclasses of VirtualFileSystemHelper. An instance of VirtualFileSystemHelper is registered with VirtualFileSystem in association with a particular scheme. Scheme-specific behavior can thus be encapsulated by a specific implementation of VirtualFileSystemHelper. IDE implementations do not need to register an implementation of this service. The default registered implementation delegates most of its operations to registered VirtualFileSystemHelpers.


Field Summary
static java.lang.String FILE_SCHEME
          The "file" URI scheme.
static java.lang.String HTTP_SCHEME
          The "http" URI scheme.
static java.lang.String JAR_SCHEME
          The "jar" URI scheme.

 

Constructor Summary
VirtualFileSystem()
           

 

Method Summary
 void addExistsTest(URIExistsTest existsTest)
          Add an implementation of the URIExistsTest interface.
 boolean canCreate(java.net.URI uri)
          Tests whether the application can create the resource at the specified URI.
 java.net.URI canonicalize(java.net.URI uri)
          Returns a canonical form of the URI, if one is available.
 boolean canRead(java.net.URI uri)
          Tests whether the application can read the resource at the specified URI.
 boolean canWrite(java.net.URI uri)
          Tests whether the application can modify the resource at the specified URI.
 java.net.URI convertSuffix(java.net.URI uri, java.lang.String oldSuffix, java.lang.String newSuffix)
          Takes the given URI and checks if its Object.toString() representation ends with the specified oldSuffix.
 void copy(java.io.InputStream in, java.net.URI dst)
          Copies the contents of in to dst.
 void copy(java.net.URI src, java.io.File dst)
          Copies the contents of src to dst.
 void copy(java.net.URI src, java.net.URI dst)
          Copies the contents at src to dst.
 java.net.URI createTempFile(java.lang.String prefix, java.lang.String suffix, java.net.URI directory)
          Creates a new empty temporary file in the specified directory using the given prefix and suffix strings to generate its name.
 boolean delete(java.net.URI uri)
          Deletes the resource pointed to by the specified URI.
 java.net.URI ensureSuffix(java.net.URI uri, java.lang.String suffix)
          This method ensures that the specified URI ends with the specified suffix.
 boolean equals(java.net.URI uri1, java.net.URI uri2)
          Returns true if both of the specified URI parameters point to the same URI instance or if both URI parameters have the same scheme and the scheme helper determines that the URI objects are equal.
 boolean exists(java.net.URI uri)
          Tests whether a resource at the specified URI location currently exists.
 VirtualFileSystemHelper findHelper(java.lang.String scheme)
          Returns the VirtualFileSystemHelper class that is currently registered to handle operations related to the specified scheme.
 VirtualFileSystemHelper findHelper(java.net.URI uri)
          Returns the VirtualFileSystemHelper class that is currently registered to handle operations related to the specified URI.
 java.net.URI getBaseParent(java.net.URI uri, java.lang.String relativeSpec)
          This method gets the base directory fully containing the relative path.
 java.lang.String getFileName(java.net.URI uri)
          Returns the name of the file contained by the URI, not including any scheme, authority, directory path, query, or fragment.
 long getLength(java.net.URI uri)
          Returns the number of bytes contained in the resource that the specified URI points to.
 java.lang.String getName(java.net.URI uri)
          Returns the name of the file contained by the URI, not including any scheme, authority, directory path, file extension, query, or fragment.
 java.net.URI getParent(java.net.URI uri)
          Returns the URI representing the parent of the specified URI.
 java.lang.String getPath(java.net.URI uri)
          Returns the path part of the URI.
 java.lang.String getPathNoExt(java.net.URI uri)
          Returns the path part of the URI without the last file extension.
 java.lang.String getPlatformPathName(java.net.URI uri)
          Returns the platform-dependent String representation of the URI; the returned string should be considered acceptable for users to read.
 java.lang.String getSuffix(java.net.URI uri)
          If a dot ('.') occurs in the filename part of the path part of the URI, then all of the text starting at the last dot is returned, including the dot.
static VirtualFileSystem getVirtualFileSystem()
          Gets the VirtualFileSystem implementation for this IDE.
 boolean hasSuffix(java.net.URI uri, java.lang.String suffix)
          Returns true if the path part of the URI ends with the given suffix String.
 boolean isBaseURIFor(java.net.URI uri1, java.net.URI uri2)
          Returns true if uri1 represents a a directory and uri2 points to a location within uri1's directory tree.
 boolean isBound(java.net.URI uri)
          This method tests whether the specified URI is bound to an existing resource, which may reside in memory (not yet saved) or already exist at the URI location.
 boolean isDirectory(java.net.URI uri)
          Tests whether the location indicated by the URI is a directory resource.
 boolean isDirectoryPath(java.net.URI uri)
          Tests whether the location indicated by the URI represents a directory path.
 boolean isHidden(java.net.URI uri)
          Tests whether the resource indiciated by the URI is a hidden file.
static boolean isLocalFileSystemCaseSensitive()
          Returns true if the local file system is case sensitive.
 boolean isReadOnly(java.net.URI uri)
          Returns true if the resource is read-only.
 boolean isRegularFile(java.net.URI uri)
          Tests whether the resource indiciated by the URI is a regular file.
 boolean isRoot(java.net.URI uri)
          Returns true if the specified URI corresponds to the root of a file system; false otherwise.
 boolean isValid(java.net.URI uri)
          Tests whether the specified URI is valid.
 long lastModified(java.net.URI uri)
          Returns the last modified time of the resource pointed to by the URI.
 java.net.URI[] list(java.net.URI uri)
          Returns an array of URIs identifying resources in the directory resource indicated by the URI.
 java.net.URI[] list(java.net.URI uri, URIFilter filter)
          Returns an array of URIs identifying resources in the directory resource indicated by the URI; the specified URIFilter is applied to determine which URIs will be returned.
 java.net.URI[] listRoots()
          Returns an array of URIs that represent the root resources available.
 boolean mkdir(java.net.URI uri)
          Creates the directory indicated by the URI.
 boolean mkdirs(java.net.URI uri)
          Creates the directory indicated by the specified URI including any necessary but nonexistent parent directories.
 java.io.InputStream openInputStream(java.net.URI uri)
          Opens an InputStream for the location indicated by the specified URI.
 java.io.OutputStream openOutputStream(java.net.URI uri)
          Opens an OutputStream on the URI.
 void registerHelper(java.lang.String scheme, VirtualFileSystemHelper helper)
          Registers the specified VirtualFileSystemHelper as the object that can handle VirtualFileSystem operations for URIs of the specified scheme.
 boolean renameTo(java.net.URI oldURI, java.net.URI newURI)
          Renames the resource indicated by the first URI to the name indicated by the second URI.
 boolean setLastModified(java.net.URI uri, long time)
          Sets the last-modified timestamp of the resource indicated by the URI to the time specified by time.
 boolean setReadOnly(java.net.URI uri, boolean readOnly)
          Sets the read-only status of the resource indicated by the URI according to the specified readOnly flag.
 java.lang.String toDisplayString(java.net.URI uri)
          Returns a displayable form of the complete URI.
 java.lang.String toRelativeSpec(java.net.URI uri, java.net.URI base)
          Converts a uri to a relative spec.
 java.lang.String toRelativeSpec(java.net.URI uri, java.net.URI base, boolean mustConsumeBase)
          Converts a uri to a relative spec.
 java.net.URL toURL(java.net.URI uri)
          Get a URL from a URI.

 

Methods inherited from class javax.ide.Service
getService, initialize, resetAllServices

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

FILE_SCHEME

public static final java.lang.String FILE_SCHEME
The "file" URI scheme.
See Also:
Constant Field Values

HTTP_SCHEME

public static final java.lang.String HTTP_SCHEME
The "http" URI scheme.
See Also:
Constant Field Values

JAR_SCHEME

public static final java.lang.String JAR_SCHEME
The "jar" URI scheme.
See Also:
Constant Field Values

Constructor Detail

VirtualFileSystem

public VirtualFileSystem()

Method Detail

registerHelper

public void registerHelper(java.lang.String scheme,
                           VirtualFileSystemHelper helper)
Registers the specified VirtualFileSystemHelper as the object that can handle VirtualFileSystem operations for URIs of the specified scheme.
Parameters:
scheme - the URI scheme to register a helper for. Must not be null or an empty String.
helper - the helper to register for the specified scheme. Must not be null.

findHelper

public VirtualFileSystemHelper findHelper(java.lang.String scheme)
Returns the VirtualFileSystemHelper class that is currently registered to handle operations related to the specified scheme. If there is no registered helper, then a default helper is returned that can produce a default result.
Parameters:
scheme - the scheme to look up the helper for. Must not be null.
Returns:
the registered file system helper for the specified scheme, or a default helper if no helper is registered.

findHelper

public VirtualFileSystemHelper findHelper(java.net.URI uri)
Returns the VirtualFileSystemHelper class that is currently registered to handle operations related to the specified URI. If there is no registered helper, then a default helper is returned that can produce a default result.
Parameters:
uri - a uri to find the helper for. May be null, in which case the default helper is returned.
Returns:
the helper for the scheme of the specified uri, or the default helper if the uri is null or no helper is registered for the scheme of the uri.

addExistsTest

public void addExistsTest(URIExistsTest existsTest)
Add an implementation of the URIExistsTest interface. The existsTest object will be called by the isBound() method to determine if an URI is unique.
Parameters:
existsTest - the implementation of an existence test for uris. Must not be null.

canonicalize

public java.net.URI canonicalize(java.net.URI uri)
                          throws java.io.IOException
Returns a canonical form of the URI, if one is available.
Parameters:
uri - the uri to canonicalize.
Returns:
a canonicalized form of the specified uri.
Throws:
java.io.IOException - if the uri could not be canonicalized.
See Also:
VirtualFileSystemHelper.canonicalize( URI )

canRead

public boolean canRead(java.net.URI uri)
Tests whether the application can read the resource at the specified URI.
Parameters:
uri - the uri to check.
Returns:
true if and only if the specified URI points to a resource that exists and can be read by the application; false otherwise.
See Also:
VirtualFileSystemHelper.canRead( URI )

canWrite

public boolean canWrite(java.net.URI uri)
Tests whether the application can modify the resource at the specified URI.
Parameters:
uri - the uri to check.
Returns:
true if and only if the specified URI points to a file that exists and the application is allowed to write to the file; false otherwise.
See Also:
VirtualFileSystemHelper.canWrite( URI )

canCreate

public boolean canCreate(java.net.URI uri)
Tests whether the application can create the resource at the specified URI. This method tests that all components of the path can be created. If the resource pointed by the URI is read-only, this method returns false.
Parameters:
uri - the uri to check.
Returns:
true if the resource at the specified URI exists or can be created; false otherwise.
See Also:
VirtualFileSystemHelper.canCreate( java.net.URI )

isValid

public boolean isValid(java.net.URI uri)
Tests whether the specified URI is valid. If the resource pointed by the URI exists the method returns true. If the resource does not exist, the method tests that all components of the path can be created.
Parameters:
uri - the uri to check.
Returns:
true if the URI is valid.
See Also:
VirtualFileSystemHelper.isValid( java.net.URI )

convertSuffix

public java.net.URI convertSuffix(java.net.URI uri,
                                  java.lang.String oldSuffix,
                                  java.lang.String newSuffix)
Takes the given URI and checks if its Object.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 URI does not end with the oldSuffix, then the newSuffix is simply appended to the end of the original URI.
Parameters:
uri - the uri to check.
oldSuffix - the old suffix to check for.
newSuffix - the new suffix to use.
Returns:
a new uri with the old suffix replaced by the new suffix, or the new suffix appended if the original uri did not end with oldSuffix.
See Also:
VirtualFileSystemHelper.convertSuffix( URI, String, String )

copy

public void copy(java.net.URI src,
                 java.net.URI dst)
          throws java.io.IOException
Copies the contents at src to dst. If the destination directory does not exist, it will be created. IOException is thrown if:
Parameters:
src - the uri of the resource to copy from. Must not be null.
dst - the uri of the resource to copy to. Must not be null.
Throws:
java.io.IOException - if an error occurs copying the resource from the old uri to the new uri.

copy

public void copy(java.io.InputStream in,
                 java.net.URI dst)
          throws java.io.IOException
Copies the contents of in to dst.
Parameters:
in - an input stream to read data from. Must not be null.
dst - a uri to copy data to. Must not be null.
Throws:
java.io.IOException - if an error occurs reading or writing.

copy

public void copy(java.net.URI src,
                 java.io.File dst)
          throws java.io.IOException
Copies the contents of src to dst.
Parameters:
src - the uri of a resource to read data from. Must not be null.
dst - a file object to write data to. Must not be null.
Throws:
java.io.IOException - if an error occurs copying data.

delete

public boolean delete(java.net.URI uri)
Deletes the resource pointed to by the specified URI. If the resource 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).
Parameters:
uri - the uri of the resource to delete.
Returns:
true if and only if the file or directory is successfully deleted; false otherwise.
See Also:
VirtualFileSystemHelper.delete( URI )

ensureSuffix

public java.net.URI ensureSuffix(java.net.URI uri,
                                 java.lang.String suffix)
This method ensures that the specified URI 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 URI already ends in the specified suffix, then the URI itself is returned. Otherwise, a new URI is created with the the specified suffix appended to the original URI's path part, and the new URI is returned.

Parameters:
uri - the uri to check. Must not be null.
suffix - the suffix to ensure the specified uri has. Must not be null.
Returns:
An URI, based on the specified URI, whose path part ends with the specified suffix.

equals

public boolean equals(java.net.URI uri1,
                      java.net.URI uri2)
Returns true if both of the specified URI parameters point to the same URI instance or if both URI parameters have the same scheme and the scheme helper determines that the URI objects are equal.
Parameters:
uri1 - the first uri to compare.
uri2 - the second uri to compare.
Returns:
true if the two uris are both null or the same instance, or if the schemes are equal and the registered VirtualFileSystemHelper for the scheme returns true from equals(uri1,uri2).
See Also:
VirtualFileSystemHelper.equals( URI, URI )

exists

public boolean exists(java.net.URI uri)
Tests whether a resource at the specified URI 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(URI).
Parameters:
uri - the uri of a resource to check for existence. Must not be null.
Returns:
true if and only if a resource already exists at the specified URI location; false otherwise.
See Also:
VirtualFileSystemHelper.exists( URI )

getFileName

public java.lang.String getFileName(java.net.URI uri)
Returns the name of the file contained by the URI, not including any scheme, authority, directory path, query, or fragment. This simply returns the simple filename. For example, if you pass in an URI whose string representation is:
scheme://userinfo@host:1010/dir1/dir2/file.ext?query#fragment
the returned value is "file.ext" (without the quotes).
Parameters:
uri - the uri to get the file name of. Must not be null.
Returns:
The simple filename of the specified URI. This value should only be used for display purposes and not for opening streams or otherwise trying to locate the document.
See Also:
VirtualFileSystemHelper.getFileName( URI )

getLength

public long getLength(java.net.URI uri)
Returns the number of bytes contained in the resource that the specified URI points to. If the length cannot be determined, -1 is returned.
Parameters:
uri - the uri of the resource to get the size of. Must not be null.
Returns:
the size in bytes of the document at the specified URI.
See Also:
VirtualFileSystemHelper.getLength( URI )

getName

public java.lang.String getName(java.net.URI uri)
Returns the name of the file contained by the URI, not including any scheme, authority, directory path, file extension, query, or fragment. This simply returns the simple filename. For example, if you pass in an URI whose string representation is:
scheme://userinfo@host:1010/dir1/dir2/file.ext1.ext2?query#fragment
the returned value is "file" (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 URI.

Parameters:
uri - the uri to get the name of. Must not be null.
Returns:
the simple name of the uri without an extension.
See Also:
VirtualFileSystemHelper.getName( URI )

getParent

public java.net.URI getParent(java.net.URI uri)
Returns the URI representing the parent of the specified URI. If there is no parent then null is returned.
Parameters:
uri - the uri of the resource to get the parent of. Must not be null.
Returns:
the uri of the parent resource, or null if the specified resource has no parent.
See Also:
VirtualFileSystemHelper.getParent( URI )

getPath

public java.lang.String getPath(java.net.URI uri)
Returns the path part of the URI. The returned string is acceptable to use in one of the URIFactory methods that takes a path.

This implementation delegates to URI.getPath().

Parameters:
uri - the uri to get the path of. Must not be null.
Returns:
the path of the specified uri.
See Also:
VirtualFileSystemHelper.getPath( URI )

getPathNoExt

public java.lang.String getPathNoExt(java.net.URI uri)
Returns the path part of the URI without the last file extension. To clarify, the following examples demonstrate the different cases:
Path part of input URI
Output 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 /
Parameters:
uri - the uri to get the path of without extension. Must not be null.
Returns:
the path of the specified uri without its extension.
See Also:
VirtualFileSystemHelper.getPathNoExt( URI )

getPlatformPathName

public java.lang.String getPlatformPathName(java.net.URI uri)
Returns the platform-dependent String representation of the URI; the returned string should be considered acceptable for users to read. In general, the returned string should omit as many parts of the URI as possible. For the "file" scheme, therefore, the platform pathname should just be the pathname alone (no scheme) using the appropriate file separator character for the current platform. For other schemes, it may be necessary to reformat the URI string into a more human-readable form. That decision is left to each VirtualFileSystemHelper implementation.
Parameters:
uri - the uri of the resource to get the platform path name of. Must not be null.
Returns:
The path portion of the specified URI 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.
See Also:
VirtualFileSystemHelper.getPlatformPathName( URI )

getSuffix

public java.lang.String getSuffix(java.net.URI uri)
If a dot ('.') occurs in the filename part of the path part of the URI, 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:

Parameters:
uri - the uri to get the suffix of. Must not be null.
Returns:
the suffix of the specified uri.
See Also:
VirtualFileSystemHelper.getSuffix( URI )

hasSuffix

public boolean hasSuffix(java.net.URI uri,
                         java.lang.String suffix)
Returns true if the path part of the URI 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 URI ends with a particular file extension, then the suffix parameter must begin with a '.' character to ensure that you get the right return value.
Parameters:
uri - the uri to check. Must not be null.
suffix - the suffix to check for. Must not be null.
Returns:
true if the specified suffix is present on the specified uri.
See Also:
VirtualFileSystemHelper.hasSuffix( URI, String )

isBaseURIFor

public boolean isBaseURIFor(java.net.URI uri1,
                            java.net.URI uri2)
Returns true if uri1 represents a a directory and uri2 points to a location within uri1's directory tree.
Parameters:
uri1 - the uri of a directory resource.
uri2 - the uri of a resource.
Returns:
true if uri2 is uri1 or points to a descendent resource of uri1. If either uri is null, returns false.
See Also:
VirtualFileSystemHelper.isBaseURIFor( URI, URI )

isBound

public boolean isBound(java.net.URI uri)
This method tests whether the specified URI is bound to an existing resource, which may reside in memory (not yet saved) or already exist at the URI location. This is similar to exists(URI) but differs in that additional tests are applied that check whether the URI is bound to an in-memory object before the actual URI location is checked.

More precisely, "bound" means either that an URI is being used in such a way that a registered URIExistsTest is able to detect the URI's usage or that a document already exists at the URI location as determined by exists(URI)).

Checking for uniqueness of a newly generated URI is the primary use for this method.

Parameters:
uri - the uri to check, must not be null.
Returns:
true if the specified uri is bound.

isLocalFileSystemCaseSensitive

public static boolean isLocalFileSystemCaseSensitive()
Returns true if the local file system is case sensitive. Returns false if the local file system is not case sensitive.
Returns:
true if the local file system is case sensitive.

isDirectory

public boolean isDirectory(java.net.URI uri)
Tests whether the location indicated by the URI is a directory resource.
Parameters:
uri - the uri to check. Must not be null.
Returns:
true if and only if the location indicated by the URI exists and is a directory; false otherwise.
See Also:
VirtualFileSystemHelper.isDirectory( URI )

isDirectoryPath

public boolean isDirectoryPath(java.net.URI uri)
Tests whether the location indicated by the URI represents a directory path. The directory path specified by the URI need not exist.

This method is intended to be a higher performance version of the isDirectory(URI) method. Implementations of this method should attempt to ascertain whether the specified URI represents a directory path by simply examining the URI itself. Time consuming i/o operations should be avoided.

Parameters:
uri - the uri to check. Must not be null.
Returns:
true if the location indicated by the URI represents a directory path; the directory path need not exist.
See Also:
VirtualFileSystemHelper.isDirectoryPath( URI )

isHidden

public boolean isHidden(java.net.URI uri)
Tests whether the resource indiciated by the URI is a hidden file. The exact definition of hidden is scheme-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.
Parameters:
uri - the uri to check. Must not be null.
Returns:
true if the uri represents a hidden resource.
See Also:
VirtualFileSystemHelper.isHidden( URI )

isReadOnly

public boolean isReadOnly(java.net.URI uri)
Returns true if the resource is read-only. A return value of false means that trying to get an OutputStream or trying to write to an OutputStream based on the URI will cause an IOException to be thrown. If the read-only status cannot be determined for some reason, this method returns true.
Parameters:
uri - the uri of the resource to check. Must not be null.
Returns:
true if the document pointed to by the specified URI is read-only or if the read-only status cannot be determined; false otherwise.
See Also:
VirtualFileSystemHelper.isReadOnly( URI )

isRegularFile

public boolean isRegularFile(java.net.URI uri)
Tests whether the resource indiciated by the URI is a regular file. A regular is a file that is not a directory and, in addition, satisfies other system-dependent criteria.
Parameters:
uri - the uri of the resource to check. Must not be null.
Returns:
true if and only if the resource indicated by the URI exists and is a normal file.
See Also:
VirtualFileSystemHelper.isRegularFile( URI )

isRoot

public boolean isRoot(java.net.URI uri)
Returns true if the specified URI corresponds to the root of a file system; false otherwise.
Parameters:
uri - the uri of a resource to check. Must not be null.
Returns:
true if the specified uri is a resource that is the root of a file system.

lastModified

public long lastModified(java.net.URI uri)
Returns the last modified time of the resource pointed to by the URI. The returned long is the number of milliseconds since the epoch (00:00:00 GMT Jan 1, 1970). If no timestamp is available, -1 is returned.
Parameters:
uri - the uri of the resource to get the last modified time of. Must not be null.
Returns:
The last modified time of the resource pointed to by the specified URI in milliseconds since the epoch.
See Also:
VirtualFileSystemHelper.lastModified( URI )

list

public java.net.URI[] list(java.net.URI uri)
Returns an array of URIs identifying resources in the directory resource indicated by the URI. If the specified URI does not represent a directory, then this method returns null. Otherwise, an array of URIs is returned, one for each file or directory in the directory. URIs representing the directory itself or its parent are not included in the result. There is no guarantee that the URIs will be returned in any particular order.
Parameters:
uri - the uri of a directory resource. Must not be null.
Returns:
An array of URIs naming the files and directories in the directory indicated by the URI. The array will be empty if the directory is empty. Returns null if the URI does not represent a directory or if an I/O error occurs.
See Also:
VirtualFileSystemHelper.list( URI )

list

public java.net.URI[] list(java.net.URI uri,
                           URIFilter filter)
Returns an array of URIs identifying resources in the directory resource indicated by the URI; the specified URIFilter is applied to determine which URIs will be returned. If the specified URI does not represent a directory, then this method returns null. Otherwise, an array of URIs is returned, one for each file or directory in the directory that is accepted by the specified filter. URIs representing the directory itself or its parent are not included in the result. There is no guarantee that the URIs will occur in any particular order.

If the specified URIFilter is null then no filtering behavior is done.

Parameters:
uri - the uri of a directory resource. Must not be null.
filter - a filter to use when retrieving the child resources of the specified uri. May be null, in which case no filtering is done.
Returns:
An array of URIs naming the files and directories in the directory indicated by the URI that are accepted by the specified URIFilter. The array will be empty if the directory is empty. Returns null if the URI does not represent a directory or if an I/O error occurs.
See Also:
VirtualFileSystemHelper.list( URI, URIFilter )

listRoots

public java.net.URI[] listRoots()
Returns an array of URIs that represent the root resources available. The determination of the roots is delegated to each registered VirtualFileSystemHelper.
Returns:
an array of root resources retrieved from each registered VirtualFileSystemHelper.

mkdir

public boolean mkdir(java.net.URI uri)
Creates the directory indicated by the URI.
Parameters:
uri - the uri of a potential directory resource. Must not be null.
Returns:
true if and only if the directory was created; false otherwise.
See Also:
VirtualFileSystemHelper.mkdir( URI )

mkdirs

public boolean mkdirs(java.net.URI uri)
Creates the directory indicated by the specified URI 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.
Parameters:
uri - the uri of a potential directory resource. Must not be null.
Returns:
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.
See Also:
VirtualFileSystemHelper.mkdirs( URI )

createTempFile

public java.net.URI createTempFile(java.lang.String prefix,
                                   java.lang.String suffix,
                                   java.net.URI directory)
                            throws java.io.IOException
Creates a new empty temporary file in the specified directory using the given prefix and suffix strings to generate its name.
Parameters:
prefix - The prefix string to be used in generating the file's name; must be at least three characters long
suffix - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
directory - The directory in which the file is to be created, or null if the default temporary-file directory is to be used
Returns:
The URI to the temporary file.
Throws:
java.io.IOException - if an error occurs creating the temporary file.
See Also:
VirtualFileSystemHelper.createTempFile( String, String, URI )

openInputStream

public java.io.InputStream openInputStream(java.net.URI uri)
                                    throws java.io.IOException
Opens an InputStream for the location indicated by the specified URI.
Parameters:
uri - An InputStream is opened on the given URI. Must not be null.
Returns:
The InputStream associated with the URI.
Throws:
java.io.FileNotFoundException - if the resource at the specified URI does not exist.
java.io.IOException - if an I/O error occurs when trying to open the InputStream.
java.net.UnknownServiceException - (a runtime exception) if the scheme does not support opening an InputStream.
See Also:
VirtualFileSystemHelper.openInputStream( URI )

openOutputStream

public java.io.OutputStream openOutputStream(java.net.URI uri)
                                      throws java.io.IOException
Opens an OutputStream on the URI. If the file does not exist, the file should be created. If the directory path to the file does not exist, all necessary directories should be created.
Parameters:
uri - An OutputStream is opened on the given URI. Must not be null.
Returns:
The OutputStream associated with the URI.
Throws:
java.io.IOException - if an I/O error occurs when trying to open the OutputStream.
java.net.UnknownServiceException - (a runtime exception) if the scheme does not support opening an OutputStream.
See Also:
VirtualFileSystemHelper.openOutputStream( URI )

renameTo

public boolean renameTo(java.net.URI oldURI,
                        java.net.URI newURI)
Renames the resource indicated by the first URI to the name indicated by the second URI.

If either URI parameter is null or if both of the specified URI parameters refer to the same resource, then the rename is not attempted and failure is returned.

If the specified URI parameters do not have the same scheme, then the VirtualFileSystem handles the rename by first copying the resource to the destination with copy(URI, URI) and then deleting the original resource with delete(URI); if either operation fails, then failure is returned.

Otherwise, the scheme helper is called to perform the actual rename operation. Scheme helper implementations may therefore assume that both URI parameters are not null, do not refer to the same resource, and have the same scheme.

If the original URI refers to a nonexistent resource, then the scheme helper implementations should return failure. It is left up to the scheme helper implementations to decide whether to overwrite the destination or return failure if the destination URI refers to an existing resource.

Parameters:
oldURI - the URI of the original resource
newURI - the desired URI for the renamed resource
Returns:
true if and only if the resource is successfully renamed; false otherwise.

setLastModified

public boolean setLastModified(java.net.URI uri,
                               long time)
Sets the last-modified timestamp of the resource indicated by the URI 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.
Parameters:
uri - the uri of the resource to set the last modified timesamp of. Must not be null.
time - a last modified timestamp in milliseconds since the epoch.
Returns:
true if the last modified time of the specified resource was successful.
See Also:
VirtualFileSystemHelper.setLastModified( URI, long )

setReadOnly

public boolean setReadOnly(java.net.URI uri,
                           boolean readOnly)
Sets the read-only status of the resource indicated by the URI according to the specified readOnly flag. The return value indicates whether or not the setting of the read-only flag succeeded.
Parameters:
uri - the uri of a resource to set the read only flag of. Must not be null.
readOnly - whether the specified resource should be read only.
Returns:
true if the read only flag on the specified resource was successfully set.
See Also:
VirtualFileSystemHelper.setReadOnly( URI, boolean )

toDisplayString

public java.lang.String toDisplayString(java.net.URI uri)
Returns a displayable form of the complete URI.
Parameters:
uri - the uri of a resource. Must not be null.
Returns:
a human-readable string representing the resource.
See Also:
VirtualFileSystemHelper.toDisplayString( URI )

toRelativeSpec

public java.lang.String toRelativeSpec(java.net.URI uri,
                                       java.net.URI base)
Converts a uri to a relative spec.
Parameters:
uri - the uri to convert. Must not be null.
base - the base uri.
Returns:
the relative spec of uri
See Also:
VirtualFileSystemHelper.toRelativeSpec( URI, URI )

toRelativeSpec

public java.lang.String toRelativeSpec(java.net.URI uri,
                                       java.net.URI base,
                                       boolean mustConsumeBase)
Converts a uri to a relative spec.
Parameters:
uri - the uri to convert. Must not be null.
base - the base uri.
mustConsumeBase - If mustConsumeBase is false, then this method will return a non-null relative spec regardless of how much of the base URI is consumed during the determination.
Returns:
the relative spec of uri
See Also:
VirtualFileSystemHelper.toRelativeSpec( URI, URI )

getBaseParent

public java.net.URI getBaseParent(java.net.URI uri,
                                  java.lang.String relativeSpec)
This method gets the base directory fully containing the relative path.
Parameters:
uri - the uri to get the base directory for.
relativeSpec - a relative path.
Returns:
the base directory fully containing the relative path.
See Also:
VirtualFileSystemHelper.getBaseParent(URI, String)

toURL

public java.net.URL toURL(java.net.URI uri)
                   throws java.net.MalformedURLException
Get a URL from a URI.
Parameters:
uri - the URI to convert to a URL.
Returns:
a url representation of the uri.
Throws:
java.net.MalformedURLException - if the uri could not be converted into a URL.

getVirtualFileSystem

public static VirtualFileSystem getVirtualFileSystem()
Gets the VirtualFileSystem implementation for this IDE.
Returns:
the virtual file system implementation for this ide.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.9.0)

E52944-01


Copyright © 1997, 2015, Oracle. All rights reserved.