Methods Summary |
---|
public void | connect()Initialize the connection with the source.
// Make the connect.
conn = getLocator().getURL().openConnection();
conn.connect();
connected = true;
// Figure out the content type.
String mimeType = conn.getContentType();
if( mimeType == null) {
mimeType = ContentDescriptor.CONTENT_UNKNOWN;
}
contentType = new ContentDescriptor(
ContentDescriptor.mimeTypeToPackageName(mimeType));
// Create a source stream.
sources = new URLSourceStream[1];
sources[0] = new URLSourceStream(conn, contentType);
|
public void | disconnect()Disconnect the source.
if(connected) {
try {
sources[0].close();
} catch(IOException e) {
// There really isn't anything we can do
// if close throws an exception.
// so we'll eat it.
}
connected = false;
}
|
public java.lang.String | getContentType()Return the content type name.
// $jdr: We could probably get away with
// not doing anything here, and connecting on
// creation, given that this protocol is pretty
// "connection-less".
if( !connected) {
throw new java.lang.Error("Source is unconnected.");
}
return contentType.getContentType();
|
public java.lang.Object | getControl(java.lang.String controlName)Returns null, because this source doesn't provide
any controls.
return null;
|
public java.lang.Object[] | getControls()Returns an empty array, because this source
doesn't provide any controls.
return new Object[0];
|
public javax.media.Time | getDuration()Returns Duration.DURATION_UNKNOWN .
The duration is not available from an InputStream .
return Duration.DURATION_UNKNOWN;
|
public javax.media.protocol.PullSourceStream[] | getStreams()
// $jdr: Is this necessary? See getContentType().
if( !connected) {
throw new java.lang.Error("Unconnected source.");
}
return sources;
|
public void | start()
// Nothing to do here either.
|
public void | stop()Stops the
// sure.
|