org.jaudiotagger.audio.asf.io
Class ContentDescriptionReader

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

public class ContentDescriptionReader
extends java.lang.Object
implements ChunkReader

Reads and interprets the data of a ASF chunk containing title, author...

Author:
Christian Laireiter
See Also:
ContentDescription

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 getApplyingId()
          Returns the GUID identifying the type of chunk, this reader will parse.
 Chunk read(GUID guid, java.io.InputStream stream, long chunkStart)
          Parses the chunk.
static java.lang.String readFixedSizeUTF16Str(java.io.InputStream stream, int strLen)
          This method reads a UTF-16 encoded String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readFixedSizeUTF16Str

public static java.lang.String readFixedSizeUTF16Str(java.io.InputStream stream,
                                                     int strLen)
                                              throws java.io.IOException
This method reads a UTF-16 encoded String.
For the use this method the number of bytes used by current string must be known.
The ASF specification recommends that those strings end with a terminating zero. However it also says that it is not always the case.

Parameters:
stream - Input source
strLen - Number of bytes the String may take.
Returns:
read String.
Throws:
java.io.IOException - read errors.

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.

getApplyingId

public GUID getApplyingId()
Returns the GUID identifying the type of chunk, this reader will parse.

Specified by:
getApplyingId in interface ChunkReader
Returns:
the GUID identifying the type of chunk, this reader will parse.

read

public Chunk read(GUID guid,
                  java.io.InputStream stream,
                  long chunkStart)
           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.
chunkStart - the position in stream, the chunk starts.
Returns:
the read chunk. (Mostly a subclass of Chunk).
Throws:
java.io.IOException - On I/O Errors.