javax.media.protocol
Class URLDataSource

java.lang.Object
  |
  +--javax.media.protocol.DataSource
        |
        +--javax.media.protocol.PullDataSource
              |
              +--javax.media.protocol.URLDataSource

public class URLDataSource
extends PullDataSource

A default data-source created directly from a URL using URLConnection.


Field Summary
protected  java.net.URLConnection conn
           
protected  boolean connected
           
protected  ContentDescriptor contentType
           
protected  javax.media.protocol.URLDataSource.URLSourceStream[] sources
           
 
Constructor Summary
protected URLDataSource()
          Implemented by subclasses.
  URLDataSource(java.net.URL url)
          Construct a URLDataSource directly from a URL.
 
Method Summary
 void connect()
          Initialize the connection with the source.
 void disconnect()
          Disconnect the source.
 java.lang.String getContentType()
          Return the content type name.
 java.lang.Object getControl(java.lang.String controlName)
          Returns null, because this source doesn't provide any controls.
 java.lang.Object[] getControls()
          Returns an empty array, because this source doesn't provide any controls.
 Time getDuration()
          Returns Duration.DURATION_UNKNOWN.
 PullSourceStream[] getStreams()
          Get the collection of streams that this source manages.
 void start()
          Initiate data-transfer.
 void stop()
          Stops the
 
Methods inherited from class javax.media.protocol.DataSource
getLocator, initCheck, setLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conn

protected java.net.URLConnection conn

contentType

protected ContentDescriptor contentType

sources

protected javax.media.protocol.URLDataSource.URLSourceStream[] sources

connected

protected boolean connected
Constructor Detail

URLDataSource

protected URLDataSource()
Implemented by subclasses.

URLDataSource

public URLDataSource(java.net.URL url)
              throws java.io.IOException
Construct a URLDataSource directly from a URL.
Method Detail

getStreams

public PullSourceStream[] getStreams()
Description copied from class: PullDataSource
Get the collection of streams that this source manages. The collection of streams is entirely content dependent. The MIME type of this DataSource provides the only indication of what streams can be available on this connection.
Overrides:
getStreams in class PullDataSource
Tags copied from class: PullDataSource
Returns:
The collection of streams for this source.

connect

public void connect()
             throws java.io.IOException
Initialize the connection with the source.
Overrides:
connect in class DataSource
Throws:
java.io.IOException - Thrown if there are problems setting up the connection.

getContentType

public java.lang.String getContentType()
Return the content type name.
Overrides:
getContentType in class DataSource
Returns:
The content type name.

disconnect

public void disconnect()
Disconnect the source.
Overrides:
disconnect in class DataSource

start

public void start()
           throws java.io.IOException
Description copied from class: DataSource
Initiate data-transfer. The start method must be called before data is available. (You must call connect before calling start.)
Overrides:
start in class DataSource
Tags copied from class: DataSource
Throws:
java.io.IOException - Thrown if there are IO problems with the source when start is called.

stop

public void stop()
          throws java.io.IOException
Stops the
Overrides:
stop in class DataSource

getDuration

public Time getDuration()
Returns Duration.DURATION_UNKNOWN. The duration is not available from an InputStream.
Returns:
Duration.DURATION_UNKNOWN.

getControls

public java.lang.Object[] getControls()
Returns an empty array, because this source doesn't provide any controls.
Returns:
empty Object array.

getControl

public java.lang.Object getControl(java.lang.String controlName)
Returns null, because this source doesn't provide any controls.
Tags copied from interface: Controls
Returns:
the object that implements the control, or null.


Submit a bug or feature
Copyright 1999-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. See the Specification License for more details.
Sun, Sun Microsystems, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.