Class BasicStream

java.lang.Object
de.jarnbjo.ogg.BasicStream
All Implemented Interfaces:
PhysicalOggStream

public class BasicStream extends Object implements PhysicalOggStream
Implementation of the PhysicalOggStream interface for reading an Ogg stream from a URL. This class performs no internal caching, and will not read data from the network before requested to do so. It is intended to be used in non-realtime applications like file download managers or similar.
  • Constructor Details

  • Method Details

    • getLogicalStreams

      public Collection getLogicalStreams()
      Description copied from interface: PhysicalOggStream
      Returns a collection of objects implementing LogicalOggStream for accessing the separate logical streams within this physical Ogg stream.
      Specified by:
      getLogicalStreams in interface PhysicalOggStream
      Returns:
      a collection of objects implementing LogicalOggStream which are representing the logical streams contained within this physical stream
      See Also:
    • isOpen

      public boolean isOpen()
      Description copied from interface: PhysicalOggStream
      Checks if this stream is open for reading.
      Specified by:
      isOpen in interface PhysicalOggStream
      Returns:
      true if this stream is open for reading, false otherwise
    • close

      public void close() throws IOException
      Description copied from interface: PhysicalOggStream
      Closes this stream. After invoking this method, no further access to the stream's data is possible.
      Specified by:
      close in interface PhysicalOggStream
      Throws:
      IOException
    • getContentLength

      public int getContentLength()
    • getPosition

      public int getPosition()
    • getOggPage

      public OggPage getOggPage(int index) throws IOException
      Description copied from interface: PhysicalOggStream
      Return the Ogg page with the absolute index index, independent of the logical structure of this stream or if the index parameter is -1, the next Ogg page is returned. This method should only be used by implementations of LogicalOggStream to access the raw pages.
      Specified by:
      getOggPage in interface PhysicalOggStream
      Parameters:
      index - the absolute index starting from 0 at the beginning of the file or stream or -1 to get the next page in a non-seekable stream
      Returns:
      the Ogg page with the physical absolute index index
      Throws:
      OggFormatException - if the ogg stream is corrupted
      IOException - if some other IO error occurs
    • setTime

      public void setTime(long granulePosition) throws IOException
      Description copied from interface: PhysicalOggStream
      Sets this stream's (and its logical stream's) position to the granule position. The next packet read from any logical stream will be the first packet beginning on the first page with a granule position higher than the argument.

      At the moment, this method only works correctly for Ogg files with a single logical Vorbis stream, and due to the different interpretations of the granule position, depending on mixed content, this method will never be able to work for mixed streams. Chained and interleaved streams are also not yet supported. Actually, this method is only a hack to support seeking from JMF, but may of course be abused otherwise too :)
      Specified by:
      setTime in interface PhysicalOggStream
      Throws:
      OggFormatException - if the ogg stream is corrupted
      IOException - if some other IO error occurs
    • isSeekable

      public boolean isSeekable()
      Specified by:
      isSeekable in interface PhysicalOggStream
      Returns:
      always false