org.jaudiotagger.audio.asf.io
Class AsfExtHeaderReader

java.lang.Object
  extended by org.jaudiotagger.audio.asf.io.ChunkContainerReader<AsfExtendedHeader>
      extended by org.jaudiotagger.audio.asf.io.AsfExtHeaderReader
All Implemented Interfaces:
ChunkReader

public class AsfExtHeaderReader
extends ChunkContainerReader<AsfExtendedHeader>

This reader reads an ASF header extension object from an InputStream and creates an AsfExtendedHeader object.

Author:
Christian Laireiter

Field Summary
private static GUID[] APPLYING
          The GUID this reader applies to
 
Fields inherited from class org.jaudiotagger.audio.asf.io.ChunkContainerReader
eachChunkOnce, hasFailingReaders, LOGGER, READ_LIMIT, readerMap
 
Constructor Summary
AsfExtHeaderReader(java.util.List<java.lang.Class<? extends ChunkReader>> toRegister, boolean readChunkOnce)
          Creates a reader instance, which only utilizes the given list of chunk readers.
 
Method Summary
 boolean canFail()
          Tells whether the reader can fail to return a valid chunk.
The current Use would be a modified version of StreamChunkReader, which is configured to only manage audio streams.
protected  AsfExtendedHeader createContainer(long streamPosition, java.math.BigInteger chunkLength, java.io.InputStream stream)
          This method is called by ChunkContainerReader.read(GUID, InputStream, long) in order to create the resulting object.
 GUID[] getApplyingIds()
          Returns the GUIDs identifying the types of chunk, this reader will parse.
 
Methods inherited from class org.jaudiotagger.audio.asf.io.ChunkContainerReader
checkStream, getReader, isReaderAvailable, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPLYING

private static final GUID[] APPLYING
The GUID this reader applies to

Constructor Detail

AsfExtHeaderReader

public AsfExtHeaderReader(java.util.List<java.lang.Class<? extends ChunkReader>> toRegister,
                          boolean readChunkOnce)
Creates a reader instance, which only utilizes the given list of chunk readers.

Parameters:
toRegister - List of ChunkReader class instances, which are to be utilized by the instance.
readChunkOnce - if true, each chunk type (identified by chunk GUID) will handled only once, if a reader is available, other chunks will be discarded.
Method Detail

canFail

public boolean canFail()
Tells whether the reader can fail to return a valid chunk.
The current Use would be a modified version of StreamChunkReader, which is configured to only manage audio streams. However, the primary GUID for audio and video streams is the same. So if a stream shows itself to be a video stream, the reader would return null.

Returns:
true, if further analysis of the chunk can show, that the reader is not applicable, despite the header GUID identification told it can handle the chunk.

createContainer

protected AsfExtendedHeader createContainer(long streamPosition,
                                            java.math.BigInteger chunkLength,
                                            java.io.InputStream stream)
                                     throws java.io.IOException
This method is called by ChunkContainerReader.read(GUID, InputStream, long) in order to create the resulting object. Implementations of this class should now return a new instance of their implementation specific result AND all data should be read, until the list of chunks starts. (The Chunk.getChunkEnd() must return a sane result, too)

Specified by:
createContainer in class ChunkContainerReader<AsfExtendedHeader>
Parameters:
streamPosition - position of the stream, the chunk starts.
chunkLength - the length of the chunk (from chunk header)
stream - to read the implementation specific information.
Returns:
instance of the implementations result.
Throws:
java.io.IOException - On I/O Errors and Invalid data.

getApplyingIds

public GUID[] getApplyingIds()
Returns the GUIDs identifying the types of chunk, this reader will parse.

Returns:
the GUIDs identifying the types of chunk, this reader will parse.