org.jaudiotagger.audio.asf.data
Class AsfHeader

java.lang.Object
  extended by org.jaudiotagger.audio.asf.data.Chunk
      extended by org.jaudiotagger.audio.asf.data.ChunkContainer
          extended by org.jaudiotagger.audio.asf.data.AsfHeader

public final class AsfHeader
extends ChunkContainer

Each ASF file starts with a so called header.
This header contains other chunks. Each chunk starts with a 16 byte GUID followed by the length (in bytes) of the chunk (including GUID). The length number takes 8 bytes and is unsigned. Finally the chunk's data appears.

Author:
Christian Laireiter

Field Summary
static java.nio.charset.Charset ASF_CHARSET
          The charset "UTF-16LE" is mandatory for ASF handling.
private  long chunkCount
          An ASF header contains multiple chunks.
static byte[] ZERO_TERM
          Byte sequence representing the zero term character.
 
Fields inherited from class org.jaudiotagger.audio.asf.data.Chunk
chunkLength, guid, position
 
Constructor Summary
AsfHeader(long pos, java.math.BigInteger chunkLen, long chunkCnt)
          Creates an instance.
 
Method Summary
 ContentDescription findContentDescription()
          This method looks for an content description object in this header instance, if not found there, it tries to get one from a contained ASF header extension object.
 MetadataContainer findExtendedContentDescription()
          This method looks for an extended content description object in this header instance, if not found there, it tries to get one from a contained ASF header extension object.
 MetadataContainer findMetadataContainer(ContainerType type)
          This method searches for a metadata container of the given type.
 AudioStreamChunk getAudioStreamChunk()
          This method returns the first audio stream chunk found in the asf file or stream.
 long getChunkCount()
          Returns the amount of chunks, when this instance was created.
If chunks have been added, this won't be reflected with this call.
For that use ChunkContainer.getChunks().
 ContentDescription getContentDescription()
           
 EncodingChunk getEncodingChunk()
           
 EncryptionChunk getEncryptionChunk()
           
 MetadataContainer getExtendedContentDescription()
           
 AsfExtendedHeader getExtendedHeader()
           
 FileHeader getFileHeader()
           
 StreamBitratePropertiesChunk getStreamBitratePropertiesChunk()
           
 java.lang.String prettyPrint(java.lang.String prefix)
          This method creates a String containing useful information prepared to be printed on STD-OUT.
 
Methods inherited from class org.jaudiotagger.audio.asf.data.ChunkContainer
addChunk, assertChunkList, chunkstartsUnique, getChunks, getFirst, hasChunkByGUID, prettyPrint
 
Methods inherited from class org.jaudiotagger.audio.asf.data.Chunk
getChunckEnd, getChunkEnd, getChunkLength, getGuid, getPosition, setPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ASF_CHARSET

public static final java.nio.charset.Charset ASF_CHARSET
The charset "UTF-16LE" is mandatory for ASF handling.


ZERO_TERM

public static final byte[] ZERO_TERM
Byte sequence representing the zero term character.


chunkCount

private final long chunkCount
An ASF header contains multiple chunks.
The count of those is stored here.

Constructor Detail

AsfHeader

public AsfHeader(long pos,
                 java.math.BigInteger chunkLen,
                 long chunkCnt)
Creates an instance.

Parameters:
pos - see Chunk.position
chunkLen - see Chunk.chunkLength
chunkCnt -
Method Detail

findContentDescription

public ContentDescription findContentDescription()
This method looks for an content description object in this header instance, if not found there, it tries to get one from a contained ASF header extension object.

Returns:
content description if found, null otherwise.

findExtendedContentDescription

public MetadataContainer findExtendedContentDescription()
This method looks for an extended content description object in this header instance, if not found there, it tries to get one from a contained ASF header extension object.

Returns:
extended content description if found, null otherwise.

findMetadataContainer

public MetadataContainer findMetadataContainer(ContainerType type)
This method searches for a metadata container of the given type.

Parameters:
type - the type of the container to look up.
Returns:
a container of specified type, of null if not contained.

getAudioStreamChunk

public AudioStreamChunk getAudioStreamChunk()
This method returns the first audio stream chunk found in the asf file or stream.

Returns:
Returns the audioStreamChunk.

getChunkCount

public long getChunkCount()
Returns the amount of chunks, when this instance was created.
If chunks have been added, this won't be reflected with this call.
For that use ChunkContainer.getChunks().

Returns:
Chunkcount at instance creation.

getContentDescription

public ContentDescription getContentDescription()
Returns:
Returns the contentDescription.

getEncodingChunk

public EncodingChunk getEncodingChunk()
Returns:
Returns the encodingChunk.

getEncryptionChunk

public EncryptionChunk getEncryptionChunk()
Returns:
Returns the encodingChunk.

getExtendedContentDescription

public MetadataContainer getExtendedContentDescription()
Returns:
Returns the tagHeader.

getExtendedHeader

public AsfExtendedHeader getExtendedHeader()
Returns:
Returns the extended header.

getFileHeader

public FileHeader getFileHeader()
Returns:
Returns the fileHeader.

getStreamBitratePropertiesChunk

public StreamBitratePropertiesChunk getStreamBitratePropertiesChunk()
Returns:
Returns the streamBitratePropertiesChunk.

prettyPrint

public java.lang.String prettyPrint(java.lang.String prefix)
This method creates a String containing useful information prepared to be printed on STD-OUT.
This method is intended to be overwritten by inheriting classes.

Overrides:
prettyPrint in class ChunkContainer
Parameters:
prefix - each line gets this string prepended.
Returns:
Information of current Chunk Object.