Class PushBufferStreamAdapter

  • All Implemented Interfaces:
    javax.media.Controls, javax.media.protocol.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:
    Lyubomir Marinov
    • Field Summary

      • Fields inherited from interface javax.media.protocol.SourceStream

        LENGTH_UNKNOWN
    • Constructor Summary

      Constructors 
      Constructor Description
      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
    • 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
      • doRead

        protected int doRead​(javax.media.Buffer buffer,
                             byte[] data,
                             int offset,
                             int length)
                      throws IOException
        Implements BufferStreamAdapter#doRead(Buffer, byte[], int, int). Delegates to the wrapped PushSourceStream.
        Specified by:
        doRead in class BufferStreamAdapter<javax.media.protocol.PushSourceStream>
        Parameters:
        buffer -
        data - 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