public final class URLLocator extends AbstractLocator
A specialized Locator
implementation that operates on URLs.
This is a straight forward implementation of the Locator
interface that is based on a URL. New instances can be created using one of
the getInstance()
methods by either passing in a URL or its
string representation. The implementation of the getURL()
method
then directly returns this URL. Other methods defined in the
Locator
interface are implemented as empty stubs only.
Instances of this class are immutable and thus can be shared between multiple threads.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares this object with another one.
|
static URLLocator |
getInstance(String sUrl)
Returns a
URLLocator instance for the URL specified as
string. |
static URLLocator |
getInstance(URL url)
Returns a
URLLocator instance for the specified URL. |
URL |
getURL()
Returns the URL represented by this locator.
|
int |
hashCode()
Returns a hash code for this object.
|
String |
toString()
Returns a string representation of this object.
|
getFile, getInputStream
public static URLLocator getInstance(URL url)
URLLocator
instance for the specified URL.url
- the URL (must not be null)URLLocator
instance for this URLIllegalArgumentException
- if the URL is nullpublic static URLLocator getInstance(String sUrl)
URLLocator
instance for the URL specified as
string. This method converts the given string into a URL and returns a
corresponding URLLocator
.sUrl
- the URL as stringURLLocator
for this URLLocatorException
- if the string cannot be transformed into a URLIllegalArgumentException
- if the string is nullpublic URL getURL()
public boolean equals(Object obj)
public int hashCode()
Copyright © 2016 The JGUIraffe Team. All rights reserved.