org.ocap.net.URLLocator Maven / Gradle / Ivy
/*
* Created on Feb 12, 2007
*/
package org.ocap.net;
import java.net.MalformedURLException;
import java.net.URL;
import org.davic.net.InvalidLocatorException;
import org.davic.net.Locator;
/**
* A concrete implementation of Locator
that encapsulates a URL into an object.
*
* Instances of this class MAY be used to reference any resource that is referencable
* using an instance of URL
.
*
* @see URL
*
* @author Aaron Kamienski
*/
public class URLLocator extends Locator
{
/**
* Construct an URLLocator
encapsulating the given URL.
*
* The accepted syntax SHALL be identical to that accepted by {@link URL#URL(String)}.
*
* @param url a URL string
*
* @throws InvalidLocatorException if URL(String)
would throw {@link MalformedURLException}
*/
public URLLocator(String url) throws InvalidLocatorException
{
super(url);
}
/**
* Construct an URLLocator
encapsulating the given URL.
*
* This SHALL be equivalent to new URLLocator(url.toString())
.
*
* @param url the URL expressed as an instance of URL
*
* @see #URLLocator(String)
*/
public URLLocator(URL url)
{
super(url.toString());
}
}