public abstract class URLMapper extends Object
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.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
URLMapper() |
Modifier and Type | Method and Description |
---|---|
static FileObject |
findFileObject(URL url)
Find an appropriate instance of FileObject that addresses this URL
|
static FileObject[] |
findFileObjects(URL url)
Deprecated.
Use
URLMapper.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. |
public static final int INTERNAL
public static final int EXTERNAL
file
for disk files (see File.toURI()
);
jar
to wrap other URLs (e.g. jar:file:/some/thing.jar!/some/entry).
public static final int NETWORK
public static URL findURL(FileObject fo, int type)
URLMapper.INTERNAL
) nullpublic abstract URL getURL(FileObject fo, int type)
FileUtil.toFile(org.openide.filesystems.FileObject)
nor FileUtil.toFileObject(java.io.File)
otherwise StackOverflowError maybe thrown.@Deprecated public static FileObject[] findFileObjects(URL url)
URLMapper.findFileObject(java.net.URL)
instead. findURL(FileObject fo, int type)
.url
- to wanted FileObjectspublic static FileObject findFileObject(URL url)
url
- URL to be converted to file objectpublic abstract FileObject[] getFileObjects(URL url)
findFileObject
uses just the first element (subsequent elements will not be accepted anyway).
The implementation cannot use either FileUtil.toFile(org.openide.filesystems.FileObject)
nor FileUtil.toFileObject(java.io.File)
or StackOverflowError may be thrown.
The only reason to return an array here is for backward compatibility.
url
- to wanted FileObjects