|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.common.url.URLFactory
public final class URLFactory
Creates URL instances using the FOray custom URLStreamHandler
capabilities.
The public methods in this class have a one-to-one correspondence with
the URL
constructors, and are intended to be a replacement for them.
This class essentially interposes itself between the calling code and the
URL
constructors to use its own URLStreamHandler
resolution.
This is needed because there is no clean way to be assured that the
URL
constructors use the desired custom URLStreamHandler
implementation.
where the various strategies for dealing with
custom {@link URLStreamHandler} implementations are discussed, and where
one can be selected.
Method Summary | |
---|---|
static URL |
createURL(String spec)
Creates a URL instance. |
static URL |
createURL(String protocol,
String host,
int port,
String file)
Creates a URL instance. |
static URL |
createURL(String protocol,
String host,
int port,
String file,
URLStreamHandler handler)
Creates a URL instance. |
static URL |
createURL(String protocol,
String host,
String file)
Creates a URL instance. |
static URL |
createURL(URL context,
String spec)
Creates a URL instance. |
static URL |
createURL(URL context,
String spec,
URLStreamHandler handler)
Creates a URL instance. |
static boolean |
isValidProtocol(String protocol)
Returns true if specified string is a valid protocol name. |
static String |
parseProtocol(String spec)
Extracts the protocol portion of a URL specification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static URL createURL(String spec) throws MalformedURLException
spec
- The String
to parse as a URL.
MalformedURLException
- If an unknown protocol is specified.which this method mimics.
public static URL createURL(String protocol, String host, int port, String file) throws MalformedURLException
protocol
- The name of the protocol to use.host
- The name of the host.port
- The port number on the host.file
- The file on the host.
MalformedURLException
- If an unknown protocol is specified.which this method mimics.
public static URL createURL(String protocol, String host, int port, String file, URLStreamHandler handler) throws MalformedURLException
protocol
- The name of the protocol to use.host
- The name of the host.port
- The port number on the host.file
- The file on the host.handler
- The stream handler for the URL.
MalformedURLException
- If an unknown protocol is specified.which this method mimics.
public static URL createURL(String protocol, String host, String file) throws MalformedURLException
protocol
- The name of the protocol to use.host
- The name of the host.file
- The file on the host.
MalformedURLException
- If an unknown protocol is specified.which this method mimics.
public static URL createURL(URL context, String spec) throws MalformedURLException
context
- The context in which to parse the specification.spec
- The String
to parse as a URL.
MalformedURLException
- If an unknown protocol is specified.which this method mimics.
public static URL createURL(URL context, String spec, URLStreamHandler handler) throws MalformedURLException
context
- The context in which to parse the specification.spec
- The String
to parse as a URL.handler
- The stream handler for the URL.
MalformedURLException
- If an unknown protocol is specified.which this method mimics.
public static String parseProtocol(String spec)
spec
- The URL specifications from which a protocol should be
extracted.
from which this code is derived.
public static boolean isValidProtocol(String protocol)
URL
method with the same
signature.
protocol
- The String to be tested for validity.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |