public class OggPage
extends java.lang.Object
An instance of this class represents an ogg page read from an ogg file
or network stream. It has no public constructor, but instances can be
created by the create
methods, supplying a JMF stream or
a RandomAccessFile
which is positioned at the beginning of an Ogg page.
Furtheron, the class provides methods for accessing the raw page data, as well as data attributes like segmenting information, sequence number, stream serial number, chechsum and wether this page is the beginning or end of a logical bitstream (BOS, EOS) and if the page data starts with a continued packet or a fresh data packet.
Modifier | Constructor and Description |
---|---|
protected |
OggPage() |
Modifier and Type | Method and Description |
---|---|
static OggPage |
create(byte[] source)
this method equals to create(byte[] source, false)
|
static OggPage |
create(byte[] source,
boolean skipData)
This method is called to
create a new OggPage instance based on the specified byte array.
|
static OggPage |
create(java.io.InputStream source)
this method equals to create(InputStream source, false)
|
static OggPage |
create(java.io.InputStream source,
boolean skipData)
This method is called to read data from the current position in the
specified InpuStream and create a new OggPage instance based on the data
read.
|
static OggPage |
create(java.io.RandomAccessFile source)
this method equals to create(RandomAccessFile source, false)
|
static OggPage |
create(java.io.RandomAccessFile source,
boolean skipData)
This method is called to read data from the current position in the
specified RandomAccessFile and create a new OggPage instance based on the data
read.
|
long |
getAbsoluteGranulePosition()
Returns the absolute granule position of the last complete
packet contained in this Ogg page, or -1 if the page contains a single
packet, which is not completed on this page.
|
byte[] |
getData() |
byte[] |
getHeader() |
int |
getPageCheckSum()
Return the check sum of this ogg page.
|
int |
getPageSequenceNumber()
Return the sequnce number of this ogg page.
|
int[] |
getSegmentLengths() |
int[] |
getSegmentOffsets() |
byte[] |
getSegmentTable() |
int |
getStreamSerialNumber()
Returns the stream serial number of this ogg page.
|
int |
getTotalLength() |
boolean |
isBos() |
boolean |
isContinued() |
boolean |
isEos() |
boolean |
isFresh() |
public static OggPage create(java.io.RandomAccessFile source) throws java.io.IOException, EndOfOggStreamException, OggFormatException
java.io.IOException
EndOfOggStreamException
OggFormatException
create(RandomAccessFile, boolean)
public static OggPage create(java.io.RandomAccessFile source, boolean skipData) throws java.io.IOException, EndOfOggStreamException, OggFormatException
skipData
is set to true
,
the actual page segments (page data) is skipped and not read into
memory. This mode is useful when scanning through an ogg file to build
a seek table.source
- the source from which the ogg page is generatedskipData
- if set to true
, the actual page data is not read into memoryFormatException
- if the data read from the specified source is not matching the specification for an ogg pageEndOfStreamException
- if it is not possible to read an entire ogg page from the specified sourcejava.io.IOException
- if some other I/O error is detected when reading from the sourceEndOfOggStreamException
OggFormatException
create(RandomAccessFile)
public static OggPage create(java.io.InputStream source) throws java.io.IOException, EndOfOggStreamException, OggFormatException
java.io.IOException
EndOfOggStreamException
OggFormatException
create(InputStream, boolean)
public static OggPage create(java.io.InputStream source, boolean skipData) throws java.io.IOException, EndOfOggStreamException, OggFormatException
skipData
is set to true
,
the actual page segments (page data) is skipped and not read into
memory. This mode is useful when scanning through an ogg file to build
a seek table.source
- the source from which the ogg page is generatedskipData
- if set to true
, the actual page data is not read into memoryFormatException
- if the data read from the specified source is not matching the specification for an ogg pageEndOfStreamException
- if it is not possible to read an entire ogg page from the specified sourcejava.io.IOException
- if some other I/O error is detected when reading from the sourceEndOfOggStreamException
OggFormatException
create(InputStream)
public static OggPage create(byte[] source) throws java.io.IOException, EndOfOggStreamException, OggFormatException
java.io.IOException
EndOfOggStreamException
OggFormatException
create(byte[], boolean)
public static OggPage create(byte[] source, boolean skipData) throws java.io.IOException, EndOfOggStreamException, OggFormatException
source
- the source from which the ogg page is generatedskipData
- if set to true
, the actual page data is not read into memoryFormatException
- if the data read from the specified source is not matching the specification for an ogg pageEndOfStreamException
- if it is not possible to read an entire ogg page from the specified sourcejava.io.IOException
- if some other I/O error is detected when reading from the sourceEndOfOggStreamException
OggFormatException
create(byte[])
public long getAbsoluteGranulePosition()
public int getStreamSerialNumber()
public int getPageSequenceNumber()
public int getPageCheckSum()
public int getTotalLength()
public byte[] getData()
public byte[] getHeader()
public byte[] getSegmentTable()
public int[] getSegmentOffsets()
public int[] getSegmentLengths()
public boolean isContinued()
true
if this page begins with a continued packetpublic boolean isFresh()
true
if this page begins with a fresh packetpublic boolean isBos()
true
if this page is the beginning of a logical streampublic boolean isEos()
true
if this page is the end of a logical streamCopyright © 2014 Tor-Einar Jarnbjo. All Rights Reserved.