FileDocCategorySizeDatePackage
MediaLocator.javaAPI DocJMF 2.1.1e2700Mon May 12 12:20:36 BST 2003javax.media

MediaLocator

public class MediaLocator extends Object implements Serializable
MediaLocator describes the location of media content. MediaLocator is closely related to URL. URLs can be obtained from MediaLocators, and MediaLocators can be constructed from URL. Unlike a URL, a MediaLocator can be instanced without a URLStreamHandler installed on the System.
see
java.net.URL
see
java.net.URLStreamHandler

Fields Summary
private URL
url
private String
locatorString
Constructors Summary
public MediaLocator(URL url)

param
url The URL to construct this media locator from.

	this.url = url;
	// $jdr: Should we check for more stuff that
	// might be wrong in this string?
	locatorString = url.toString().trim();
    
public MediaLocator(String locatorString)

	this.locatorString = locatorString.trim();
    
Methods Summary
public java.lang.StringgetProtocol()
Get the beginning of the locator string up to but not including the first colon.

return
The protocol for this MediaLocator.

	String protocol = "";
	int colonIndex = locatorString.indexOf(':");

	// $jdr: Should this throw an exception or
	// return an empty string?
	if( colonIndex != -1) {
	    protocol = locatorString.substring(0,colonIndex);
	}

	return protocol;
    
public java.lang.StringgetRemainder()
Get the MediaLocator string with the protocol removed.

return
The argument string.

	String remainder = "";
	int colonIndex = locatorString.indexOf(":");

	if( colonIndex != -1) {
	    remainder = locatorString.substring(colonIndex + 1);
	}

	return remainder;
    
public java.net.URLgetURL()
Get the URL associated with this MediaLocator.

	if( url == null) {
	    url = new URL(locatorString);
	}

	return url;
    
public java.lang.StringtoExternalForm()
Create a string from the URL argument that can be used to construct the MediaLocator.

return
A string for the MediaLocator.

	return locatorString;
    
public java.lang.StringtoString()
Used for printing MediaLocators.

return
A string for printing MediaLocators.

	return locatorString;