org.gagravarr.ogg
Class OggPage

java.lang.Object
  extended by org.gagravarr.ogg.OggPage

public class OggPage
extends Object


Nested Class Summary
protected  class OggPage.OggPacketIterator
          Returns a full OggPacket if it can, otherwise just the OggPacketData if the rest of the packet is in another OggPage
 
Constructor Summary
protected OggPage(InputStream inp)
          InputStream should be positioned *just after* the OggS capture pattern.
protected OggPage(int sid, int seqNum)
           
 
Method Summary
protected  int addPacket(OggPacket packet, int offset)
          Adds as much of the packet's data as we can do.
protected  long getChecksum()
           
 byte[] getData()
           
 int getDataSize()
          How big is the page, excluding headers?
 long getGranulePosition()
           
protected  byte[] getHeader()
          Gets the header, but with a blank CRC field
protected  int getNumLVs()
          For unit testing only!
 OggPage.OggPacketIterator getPacketIterator()
           
 OggPage.OggPacketIterator getPacketIterator(OggPacketData previousPart)
           
 int getPageSize()
          How big is the page, including headers?
 int getSequenceNumber()
           
 int getSid()
           
 boolean hasContinuation()
          Is there a subsequent page containing the remainder of the packets?
protected  boolean hasSpaceFor(int bytes)
          Does this Page have space for the given number of bytes?
 boolean isChecksumValid()
          Is the checksum for the page valid?
 boolean isContinuation()
          Is this carrying on the packets from a previous page?
protected  void setGranulePosition(long position)
           
protected  void setIsContinuation()
           
protected  void setIsEOS()
          This should only ever be called by OggPacketWriter.close() !
 String toString()
           
 void writeHeader(OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OggPage

protected OggPage(int sid,
                  int seqNum)

OggPage

protected OggPage(InputStream inp)
           throws IOException
InputStream should be positioned *just after* the OggS capture pattern.

Throws:
IOException
Method Detail

addPacket

protected int addPacket(OggPacket packet,
                        int offset)
Adds as much of the packet's data as we can do.


isChecksumValid

public boolean isChecksumValid()
Is the checksum for the page valid?


getChecksum

protected long getChecksum()

hasSpaceFor

protected boolean hasSpaceFor(int bytes)
Does this Page have space for the given number of bytes?


getPageSize

public int getPageSize()
How big is the page, including headers?


getDataSize

public int getDataSize()
How big is the page, excluding headers?


getSid

public int getSid()

getSequenceNumber

public int getSequenceNumber()

getGranulePosition

public long getGranulePosition()

getData

public byte[] getData()

setGranulePosition

protected void setGranulePosition(long position)

hasContinuation

public boolean hasContinuation()
Is there a subsequent page containing the remainder of the packets?


isContinuation

public boolean isContinuation()
Is this carrying on the packets from a previous page?


setIsContinuation

protected void setIsContinuation()

setIsEOS

protected void setIsEOS()
This should only ever be called by OggPacketWriter.close() !


getNumLVs

protected int getNumLVs()
For unit testing only!


writeHeader

public void writeHeader(OutputStream out)
                 throws IOException
Throws:
IOException

getHeader

protected byte[] getHeader()
Gets the header, but with a blank CRC field


toString

public String toString()
Overrides:
toString in class Object

getPacketIterator

public OggPage.OggPacketIterator getPacketIterator()

getPacketIterator

public OggPage.OggPacketIterator getPacketIterator(OggPacketData previousPart)


Copyright © 2012. All Rights Reserved.