Methods Summary |
---|
public boolean | endOfStream()Find out if the end of the stream has been reached.
// currently we just return false but it should be changed
return false;
|
public javax.media.protocol.ContentDescriptor | getContentDescriptor()Get the current content type for this stream.
// temporary implemantation
return new ContentDescriptor("raw");
|
public long | getContentLength()Get the size, in bytes, of the content on this stream.
LENGTH_UNKNOWN is returned if the length is not known.
return LENGTH_UNKNOWN;
|
public java.lang.Object | getControl(java.lang.String controlType)Obtain the object that implements the specified
Class or Interface
The full class or interface name must be used.
If the control is not supported then null
is returned.
// no control implemented
return null;
|
public java.lang.Object[] | getControls()Obtain the collection of objects that
control the object that implements this interface.
If no controls are supported, a zero length
array is returned.
// no controls implemented
return new Object[0];
|
public javax.media.Format | getFormat()Obtain the format that this object is set to.
com.sun.media.JMFSecurityManager.loadLibrary("jmdevice");
// TEMPORARY IMPLEMENTATION
return new AudioFormat(AudioFormat.LINEAR, 22050, 16, 1);
|
public int | getMinimumTransferSize()Determine the size of the buffer needed for the data transfer.
This method is provided so that a transfer handler
can determine how much data, at a minimum, will be
available to transfer from the source.
Overflow and data loss is likely to occur if this much
data isn't read at transfer time.
/* NOT IMPLEMENTED YET */
return 128;
|
private native boolean | isBufferFilled()Checks a the bufferFilled flag in the native code
|
public native synchronized int | read(byte[] buffer, int offset, int length)Read from the stream without blocking.
Returns -1 when the end of the media
is reached.
|
public void | run()Runnable's method implementation
while (started) {
handler.transferData(this);
while (!isBufferFilled()) {
try {
synchronized(this) {
wait();
}
}
catch (InterruptedException e) {
System.out.println("Exception: " + e);
}
}
}
started = true; // this is a temporary solution for signaling the thead exit
|
public void | setTransferHandler(javax.media.protocol.SourceTransferHandler transferHandler)Register an object to service data transfers to this stream.
If a handler is already registered when
setTransferHandler is called,
the handler is replaced;
there can only be one handler at a time.
handler = transferHandler;
|
void | start()Starts a thread to initiate trasferData called on the Handler.
The thread will wait untill the buffer sent to the device is
full and than will call trasferData again
triggerThread = new Thread(this);
started = true;
triggerThread.start();
|
void | stop()Stops the thread
started = false;
while (!started); // TEMPORARY SOLUTION, TO BE REPLACED
|