org.jaudiotagger.audio.asf.io
Class MetadataReader

java.lang.Object
  extended by org.jaudiotagger.audio.asf.io.MetadataReader
All Implemented Interfaces:
ChunkReader

public class MetadataReader
extends java.lang.Object
implements ChunkReader

Reads an interprets "Metadata Object", "Metadata Library Object" and "Extended Content Description" of ASF files.

Author:
Christian Laireiter

Field Summary
private static GUID[] APPLYING
          The GUID this reader applies to
 
Constructor Summary
MetadataReader()
           
 
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.
 GUID[] getApplyingIds()
          Returns the GUIDs identifying the types of chunk, this reader will parse.
 Chunk read(GUID guid, java.io.InputStream stream, long streamPosition)
          Parses the chunk.
private  boolean readBoolean(java.io.InputStream stream, int bytes)
          Reads the given amount of bytes and checks the last byte, if its equal to one or zero (true / false).
All other bytes must be zero.
 
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

MetadataReader

public MetadataReader()
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.

Specified by:
canFail in interface ChunkReader
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.

getApplyingIds

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

Specified by:
getApplyingIds in interface ChunkReader
Returns:
the GUIDs identifying the types of chunk, this reader will parse.

read

public Chunk read(GUID guid,
                  java.io.InputStream stream,
                  long streamPosition)
           throws java.io.IOException
Parses the chunk.

Specified by:
read in interface ChunkReader
Parameters:
guid - the GUID of the chunks header, which is about to be read.
stream - source to read chunk from.
No GUID is expected at the currents stream position. The length of the chunk is about to follow.
streamPosition - the position in stream, the chunk starts.
Returns:
the read chunk. (Mostly a subclass of Chunk).
Throws:
java.io.IOException - On I/O Errors.

readBoolean

private boolean readBoolean(java.io.InputStream stream,
                            int bytes)
                     throws java.io.IOException
Reads the given amount of bytes and checks the last byte, if its equal to one or zero (true / false).
All other bytes must be zero. (if assertions enabled).

Parameters:
stream - stream to read from.
bytes - amount of bytes
Returns:
true or false.
Throws:
java.io.IOException - on I/O Errors