FileDocCategorySizeDatePackage
RtspUrl.javaAPI DocJMF 2.1.1e1396Mon May 12 12:20:56 BST 2003com.sun.media.rtsp

RtspUrl

public class RtspUrl extends Object

Fields Summary
private String
url
Constructors Summary
public RtspUrl(String url)

        this.url = url;

	if( url.length() < 7) {
	    throw new MalformedURLException();
	}

	if( !url.startsWith( "rtsp://")) {
	    throw new MalformedURLException();
	}
    
Methods Summary
public java.lang.StringgetFile()

        String str = url.substring(7);

        int start = str.indexOf('/");

	String file= "";
	
	if( start != -1) {
            file = str.substring( start + 1);
	}
	
        return file;
    
public java.lang.StringgetHost()

	String host= null;
	
        String str = url.substring(7);

        int end = str.indexOf(':");

        if (end == -1) {
            end = str.indexOf('/");

	    if( end == -1) {
		host= str;
	    } else {
		host= str.substring( 0, end);
	    }
        } else {
            host = str.substring(0, end);
	}

        return host;
    
public intgetPort()

        int port = 554; // default port for RTSP

        String str = url.substring(7);

        int start = str.indexOf(':");

        if (start != -1) {
            int end = str.indexOf('/");

            port = new Integer(str.substring(start + 1, end)).intValue();
        }

        return port;