Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

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

public class PullBufferStreamAdapter
extends BufferStreamAdapter<javax.media.protocol.PullSourceStream>
implements javax.media.protocol.PullBufferStream

Represents a PullBufferStream which reads its data from a specific PullSourceStream.

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
PullBufferStreamAdapter(javax.media.protocol.PullSourceStream stream, javax.media.Format format)
          Initializes a new PullBufferStreamAdapter instance which reads its data from a specific PullSourceStream with a specific Format
 
Method Summary
 void read(javax.media.Buffer buffer)
          Implements PullBufferStream#read(Buffer).
protected  int read(byte[] buffer, int offset, int length)
          Implements BufferStreamAdapter#read(byte[], int, int).
 boolean willReadBlock()
          Implements PullBufferStream#willReadBlock().
 
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.PullBufferStream
getFormat
 
Methods inherited from interface javax.media.protocol.SourceStream
endOfStream, getContentDescriptor, getContentLength
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

PullBufferStreamAdapter

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

Parameters:
stream - the PullSourceStream 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 PullBufferStream#read(Buffer). Delegates to the wrapped PullSourceStream by either allocating a new byte[] buffer or using the existing one in the specified Buffer.

Specified by:
read in interface javax.media.protocol.PullBufferStream
Parameters:
buffer - Buffer to read
Throws:
IOException - if I/O 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 PullSourceStream.

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

willReadBlock

public boolean willReadBlock()
Implements PullBufferStream#willReadBlock(). Delegates to the wrapped PullSourceStream.

Specified by:
willReadBlock in interface javax.media.protocol.PullBufferStream
Returns:
true if this stream will block on read operation, false otherwise

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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