|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dsto.dfc.net.URLSearchPath
public class URLSearchPath
Defines a set of URL paths to search for resources. Analogous to a
Java classpath, but allows any URL in the path. Convenience
methods as as addPathEntry(java.lang.String)
and resolveToFile(java.lang.String)
allow this to be used solely as a file-based search path also.
Symbolic constant expansion is provided inside path entries via a
property set (see setSymbols(java.util.Properties)
).
Constructor Summary | |
---|---|
URLSearchPath()
|
Method Summary | |
---|---|
void |
addPathEntry(String file)
Shortcut to add a file to the search path. |
void |
addPathEntry(URL entry)
Add an entry to the set of URL's in the search path. |
protected static boolean |
containsSymbol(URL url)
|
protected static boolean |
exists(URL url)
|
protected URL |
expandSymbols(URL url)
|
List |
getEntries()
Get the search path as a list of URL's. |
Properties |
getSymbols()
|
void |
removeEntry(URL entry)
Remove an entry to the set of URL's in the search path. |
String |
resolveToFile(String path)
Convenience method to resolve to a file from a file URL-based search path. |
URL |
resolveToURL(String path)
Resolve a relative path to a URL by searching the path. |
void |
setSymbols(Properties aSymbols)
Set symbol mappings for expansion of symbolic names within search path entries. |
String |
unresolveToPath(String file)
Shortcut to convert a file path relative to this search path. |
String |
unresolveToPath(URL url)
Convert a URL to a path relative to this search path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public URLSearchPath()
Method Detail |
---|
public List getEntries()
public void addPathEntry(String file)
addPathEntry(URL)
public void addPathEntry(URL entry)
setSymbols(java.util.Properties)
).
public void removeEntry(URL entry)
public String resolveToFile(String path) throws NoSuchElementException
path
- The path to resolve. If path is absolute or exists
relative to the current directory, it is returned
without searching paths.
NoSuchElementException
- if path could not be resolved.public URL resolveToURL(String path) throws NoSuchElementException
path
- The relative path name of the resource to resolve.
NoSuchElementException
- if the path could not be
resolved to anm existing URL.public String unresolveToPath(String file)
file
- The path to convert.
unresolveToPath(URL)
public String unresolveToPath(URL url)
url
- The URL to unresolve. The first matching URL in the
path that is a prefix to the URL is used.
public Properties getSymbols()
public void setSymbols(Properties aSymbols)
StringUtility.expandSymbols(java.lang.String, java.util.Map)
for more information on
the expansion rules.
protected URL expandSymbols(URL url) throws MalformedURLException
MalformedURLException
protected static boolean containsSymbol(URL url)
protected static boolean exists(URL url)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |