public class EncapIPStream extends Object implements PushSourceStream2
PushSourceStream2 identifies a
SourceStream that pushes asynchronous data.
Note that a PushSourceStream2 provides no guarantees
of the length of time that incoming data will be buffered before
being discarded or overwritten with new data. Because of the
time-dependent nature of the stream, clients should read the pending
data immediately upon notification.
LENGTH_UNKNOWN| Constructor and Description |
|---|
EncapIPStream(Locator loc) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
endOfStream()
Find out if the end of the stream has been reached.
|
ContentDescriptor |
getContentDescriptor()
Get the current content type for this stream.
|
long |
getContentLength()
Get the size, in bytes, of the content on this stream.
|
Object |
getControl(String controlType)
Obtain the object that implements the specified Class or
Interface The full class or interface name must be used.
|
Object[] |
getControls()
Obtain the collection of objects that control the object that
implements this interface.
|
int |
getMinimumTransferSize()
Determine the size of the buffer needed for the data transfer.
|
boolean |
getOpen() |
static boolean |
isIPStreamLocator(Locator loc) |
int |
read(byte[] buffer,
int offset,
int length)
Read from the stream without blocking.
|
int |
readStream(byte[] buffer,
int offset,
int length)
Reads pending data from the stream without blocking.
|
void |
setOpen(boolean open)
this is for the DataSource or whoever constructs this stream to
open the stream.
|
void |
setTransfer(boolean transfer)
This is a method for the DataSource corresponding to the stream to
control the start/stop of the data transfer.
|
void |
setTransferHandler(SourceTransferHandler transferHandler)
Register an object to service data transfers to this stream.
|
public EncapIPStream(Locator loc) throws InvalidLocatorException
InvalidLocatorExceptionpublic static boolean isIPStreamLocator(Locator loc)
public int read(byte[] buffer,
int offset,
int length)
PushSourceStreamread in interface PushSourceStreambuffer - The buffer to read bytes into.offset - The offset into the buffer at which to begin writing data.length - The number of bytes to read.public int readStream(byte[] buffer,
int offset,
int length)
throws IOException,
DataLostException
readStream in interface PushSourceStream2buffer - The buffer to read bytes into.offset - The offset into the buffer at which to begin writing
data.length - The number of bytes to read.IOException - If an I/O error occurs.DataLostException - If data from the stream has been lost.public void setTransferHandler(SourceTransferHandler transferHandler)
PushSourceStream
If a handler is already registered when
setTransferHandler is called,
the handler is replaced;
there can only be one handler at a time.
setTransferHandler in interface PushSourceStreamtransferHandler - The handler to transfer data to.public int getMinimumTransferSize()
PushSourceStreamgetMinimumTransferSize in interface PushSourceStreampublic boolean endOfStream()
endOfStream in interface SourceStreamtrue if there is no more data.public ContentDescriptor getContentDescriptor()
getContentDescriptor in interface SourceStreamContentDescriptor for this stream.public long getContentLength()
getContentLength in interface SourceStreampublic Object[] getControls()
getControls in interface Controlspublic Object getControl(String controlType)
getControl in interface Controlsnull.public void setTransfer(boolean transfer)
transfer - -- true to start, false to stoppublic void setOpen(boolean open)
public boolean getOpen()
Copyright © 2012 code4tv.com. All Rights Reserved.