net.shredzone.ifish.ltr
Class OggFastFileStream

java.lang.Object
  extended by net.shredzone.ifish.ltr.OggFastFileStream
All Implemented Interfaces:
PhysicalOggStream

public class OggFastFileStream
extends Object
implements PhysicalOggStream

Replacement file reader class. The original J-Ogg FileStream has the major disadvantage that it reads the entire file, even though we just need a few byte from it. This FastFileStream will only read as little information as possible.

Version:
$Id: OggFastFileStream.java 289 2009-04-28 21:21:46Z shred $

Constructor Summary
OggFastFileStream(RandomAccessFile in)
          Constructor for the OggFastFileStream object
 
Method Summary
 void close()
          Closes the stream
 int getContentLength()
          Get the content length
 Collection getLogicalStreams()
          Get a collection of the logical streams.
 OggPage getOggPage(int index)
          Get an OggPage.
 int getPosition()
          Get the current position
 boolean isOpen()
          Checks if the file is open.
 boolean isSeekable()
          Is this FileStream seekable?
 void setTime(long granulePosition)
          Move the stream to a certain time position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OggFastFileStream

public OggFastFileStream(RandomAccessFile in)
                  throws OggFormatException,
                         IOException
Constructor for the OggFastFileStream object

Parameters:
in - RandomAccessFile to be read
Throws:
OggFormatException - Bad format
IOException - IO error
Method Detail

getLogicalStreams

public Collection getLogicalStreams()
Get a collection of the logical streams.

Specified by:
getLogicalStreams in interface PhysicalOggStream
Returns:
Collection
See Also:
LogicalOggStream

isOpen

public boolean isOpen()
Checks if the file is open.

Specified by:
isOpen in interface PhysicalOggStream
Returns:
true: open, false: closed

close

public void close()
           throws IOException
Closes the stream

Specified by:
close in interface PhysicalOggStream
Throws:
IOException - IO error

getContentLength

public int getContentLength()
Get the content length

Returns:
The content length

getPosition

public int getPosition()
Get the current position

Returns:
Position

getOggPage

public OggPage getOggPage(int index)
                   throws IOException
Get an OggPage.

Specified by:
getOggPage in interface PhysicalOggStream
Parameters:
index - Index to be fetched
Returns:
The oggPage value
Throws:
IOException - IO Error

setTime

public void setTime(long granulePosition)
             throws IOException
Move the stream to a certain time position.

Specified by:
setTime in interface PhysicalOggStream
Parameters:
granulePosition - The new position
Throws:
IOException
OggFormatException - if the ogg stream is corrupted

isSeekable

public boolean isSeekable()
Is this FileStream seekable? We pretend we are not, so J-Ogg will not try to do some funny stuff... ;)

Specified by:
isSeekable in interface PhysicalOggStream
Returns:
false


Copyright © 2007-2011 shredzone.org. All Rights Reserved.