Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.protocol
Class PushBufferStreamAdapter

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.protocol.BufferStreamAdapter<javax.media.protocol.PushSourceStream>
      extended by net.java.sip.communicator.impl.neomedia.protocol.PushBufferStreamAdapter
All Implemented Interfaces:
javax.media.Controls, javax.media.protocol.PushBufferStream, javax.media.protocol.SourceStream

public class PushBufferStreamAdapter
extends BufferStreamAdapter<javax.media.protocol.PushSourceStream>
implements javax.media.protocol.PushBufferStream

Represents a PushBufferStream which reads its data from a specific PushSourceStream.

Author:
Lubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.protocol.BufferStreamAdapter
stream
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Constructor Summary
PushBufferStreamAdapter(javax.media.protocol.PushSourceStream stream, javax.media.Format format)
          Initializes a new PushBufferStreamAdapter instance which reads its data from a specific PushSourceStream with a specific Format
 
Method Summary
 void read(javax.media.Buffer buffer)
          Implements PushBufferStream#read(Buffer).
protected  int read(byte[] buffer, int offset, int length)
          Implements BufferStreamAdapter#read(byte[], int, int).
 void setTransferHandler(javax.media.protocol.BufferTransferHandler transferHandler)
          Implements PushBufferStream#setTransferHandler(BufferTransferHandler).
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.protocol.BufferStreamAdapter
endOfStream, getContentDescriptor, getContentLength, getControl, getControls, getFormat, getStream, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.media.protocol.PushBufferStream
getFormat
 
Methods inherited from interface javax.media.protocol.SourceStream
endOfStream, getContentDescriptor, getContentLength
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

PushBufferStreamAdapter

public PushBufferStreamAdapter(javax.media.protocol.PushSourceStream stream,
                               javax.media.Format format)
Initializes a new PushBufferStreamAdapter instance which reads its data from a specific PushSourceStream with a specific Format

Parameters:
stream - the PushSourceStream the new instance is to read its data from
format - the Format of the specified input stream and of the new instance
Method Detail

read

public void read(javax.media.Buffer buffer)
          throws IOException
Implements PushBufferStream#read(Buffer). Delegates to the wrapped PushSourceStream by allocating a new byte[] buffer of size equal to PushSourceStream#getMinimumTransferSize().

Specified by:
read in interface javax.media.protocol.PushBufferStream
Parameters:
buffer - the Buffer to read
Throws:
IOException - if I/O related errors occurred during read operation

read

protected int read(byte[] buffer,
                   int offset,
                   int length)
            throws IOException
Implements BufferStreamAdapter#read(byte[], int, int). Delegates to the wrapped PushSourceStream.

Specified by:
read in class BufferStreamAdapter<javax.media.protocol.PushSourceStream>
Parameters:
buffer - byte array to read
offset - offset to start reading
length - length to read
Returns:
number of bytes read
Throws:
IOException - if I/O related errors occurred during read operation

setTransferHandler

public void setTransferHandler(javax.media.protocol.BufferTransferHandler transferHandler)
Implements PushBufferStream#setTransferHandler(BufferTransferHandler). Delegates to the wrapped PushSourceStream by translating the specified BufferTransferHandler to a SourceTransferHandler.

Specified by:
setTransferHandler in interface javax.media.protocol.PushBufferStream
Parameters:
transferHandler - a BufferTransferHandler to set

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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