SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.media
Class RTPConnectorInputStream

java.lang.Object
  extended by net.java.sip.communicator.impl.media.RTPConnectorInputStream
All Implemented Interfaces:
Runnable, javax.media.Controls, javax.media.protocol.PushSourceStream, javax.media.protocol.SourceStream
Direct Known Subclasses:
TransformInputStream

public class RTPConnectorInputStream
extends Object
implements javax.media.protocol.PushSourceStream, Runnable

Author:
Bing SU (nova.su@gmail.com), Lubomir Marinov

Field Summary
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Constructor Summary
RTPConnectorInputStream(DatagramSocket socket)
          Initializes a new RTPConnectorInputStream which is to receive packet data from a specific UDP socket.
 
Method Summary
 void close()
          Close this stream, stops the worker thread.
protected  RawPacket createRawPacket(DatagramPacket datagramPacket)
          Creates a new RawPacket from a specific DatagramPacket in order to have this instance receive its packet data through its read(byte[], int, int) method.
 boolean endOfStream()
           
 javax.media.protocol.ContentDescriptor getContentDescriptor()
           
 long getContentLength()
           
 Object getControl(String controlType)
           
 Object[] getControls()
           
 int getMinimumTransferSize()
           
 int read(byte[] inBuffer, int offset, int length)
           
 void run()
           
 void setTransferHandler(javax.media.protocol.SourceTransferHandler transferHandler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RTPConnectorInputStream

public RTPConnectorInputStream(DatagramSocket socket)
Initializes a new RTPConnectorInputStream which is to receive packet data from a specific UDP socket.

Parameters:
socket - the UDP socket the new instance is to receive data from
Method Detail

close

public void close()
Close this stream, stops the worker thread.


createRawPacket

protected RawPacket createRawPacket(DatagramPacket datagramPacket)
Creates a new RawPacket from a specific DatagramPacket in order to have this instance receive its packet data through its read(byte[], int, int) method. Allows extenders to intercept the packet data and possibly filter and/or modify it.

Parameters:
datagramPacket - the DatagramPacket containing the packet data
Returns:
a new RawPacket containing the packet data of the specified DatagramPacket or possibly its modification; null to ignore the packet data of the specified DatagramPacket and not make it available to this instance through its read(byte[], int, int) method

endOfStream

public boolean endOfStream()
Specified by:
endOfStream in interface javax.media.protocol.SourceStream

getContentDescriptor

public javax.media.protocol.ContentDescriptor getContentDescriptor()
Specified by:
getContentDescriptor in interface javax.media.protocol.SourceStream

getContentLength

public long getContentLength()
Specified by:
getContentLength in interface javax.media.protocol.SourceStream

getControl

public Object getControl(String controlType)
Specified by:
getControl in interface javax.media.Controls

getControls

public Object[] getControls()
Specified by:
getControls in interface javax.media.Controls

getMinimumTransferSize

public int getMinimumTransferSize()
Specified by:
getMinimumTransferSize in interface javax.media.protocol.PushSourceStream

read

public int read(byte[] inBuffer,
                int offset,
                int length)
         throws IOException
Specified by:
read in interface javax.media.protocol.PushSourceStream
Throws:
IOException

run

public void run()
Specified by:
run in interface Runnable

setTransferHandler

public void setTransferHandler(javax.media.protocol.SourceTransferHandler transferHandler)
Specified by:
setTransferHandler in interface javax.media.protocol.PushSourceStream

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.