org.openide.filesystems 6.4.22

org.openide.filesystems
Class URLMapper

java.lang.Object
  extended by org.openide.filesystems.URLMapper

public abstract class URLMapper
extends Object

Mapper from FileObject -> URL. Should be registered in default lookup. For details see Lookup.getDefault(). For all methods, if the passed-in file object is the root folder of some filesystem, then it is assumed that any valid file object in that filesystem may also have a URL constructed for it by means of appending the file object's resource path to the URL of the root folder. If this cannot work for all file objects on the filesystem, the root folder must not be assigned a URL of that type. nbfs: URLs of course always work correctly in this regard.

Since:
2.16

Field Summary
static int EXTERNAL
          URL which works inside this machine.
static int INTERNAL
          URL which works inside this VM.
static int NETWORK
          URL which works from networked machines.
 
Constructor Summary
URLMapper()
           
 
Method Summary
static FileObject findFileObject(URL url)
          Find an appropiate instance of FileObject that addresses this url
static FileObject[] findFileObjects(URL url)
          Deprecated. Use findFileObject(java.net.URL) instead.
static URL findURL(FileObject fo, int type)
          Find a good URL for this file object which works according to type: inside this VM inside this machine from networked machines
abstract  FileObject[] getFileObjects(URL url)
          Get an array of FileObjects for this url.
abstract  URL getURL(FileObject fo, int type)
          Get a good URL for this file object which works according to type: inside this VM inside this machine from networked machines The implementation can't use neither FileUtil.toFile(org.openide.filesystems.FileObject) nor FileUtil.toFileObject(java.io.File) otherwise StackOverflowError maybe thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERNAL

public static final int INTERNAL
URL which works inside this VM. Not guaranteed to work outside the VM (though it may).

See Also:
Constant Field Values

EXTERNAL

public static final int EXTERNAL
URL which works inside this machine. Not guaranteed to work from other machines (though it may).
Typical protocols used: file for disk files (see File.toURI()); jar to wrap other URLs (e.g. jar:file:/some/thing.jar!/some/entry).

See Also:
Constant Field Values

NETWORK

public static final int NETWORK
URL which works from networked machines.

See Also:
Constant Field Values
Constructor Detail

URLMapper

public URLMapper()
Method Detail

findURL

public static URL findURL(FileObject fo,
                          int type)
Find a good URL for this file object which works according to type:

Returns:
a suitable URL, or null

getURL

public abstract URL getURL(FileObject fo,
                           int type)
Get a good URL for this file object which works according to type: The implementation can't use neither FileUtil.toFile(org.openide.filesystems.FileObject) nor FileUtil.toFileObject(java.io.File) otherwise StackOverflowError maybe thrown.

Returns:
a suitable URL, or null

findFileObjects

public static FileObject[] findFileObjects(URL url)
Deprecated. Use findFileObject(java.net.URL) instead.

Find an array of FileObjects for this url Zero or more FOs may be returned. For each returned FO, it must be true that FO -> URL gives the exact URL which was passed in, but depends on appripriate type findURL(FileObject fo, int type) .

Parameters:
url - to wanted FileObjects
Returns:
a suitable arry of FileObjects, or empty array if not successful
Since:
2.22

findFileObject

public static FileObject findFileObject(URL url)
Find an appropiate instance of FileObject that addresses this url

Parameters:
url - url to be converted to file object
Returns:
file object corresponding to url or null if no one was found
Since:
4.29

getFileObjects

public abstract FileObject[] getFileObjects(URL url)
Get an array of FileObjects for this url. There is no reason to return array with size greater than one because method findFileObject uses just first element (next elements won't be accepted anyway). The implementation can't use neither FileUtil.toFile(org.openide.filesystems.FileObject) nor FileUtil.toFileObject(java.io.File) otherwise StackOverflowError maybe thrown.

There isn't necessary to return array here. The only one reason is just backward compatibility.

Parameters:
url - to wanted FileObjects
Returns:
an array of FileObjects with size no greater than one, or null
Since:
2.22

org.openide.filesystems 6.4.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.