Class PullBufferStreamAdapter

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

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

        LENGTH_UNKNOWN
    • Constructor Summary

      Constructors 
      Constructor Description
      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
    • 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
      • 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 PullSourceStream.
        Specified by:
        doRead in class BufferStreamAdapter<javax.media.protocol.PullSourceStream>
        Parameters:
        buffer -
        data - 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