org.jaudiotagger.audio.asf.data
Class ExtendedContentDescription

java.lang.Object
  extended by org.jaudiotagger.audio.asf.data.Chunk
      extended by org.jaudiotagger.audio.asf.data.ExtendedContentDescription
All Implemented Interfaces:
WriteableChunk

public class ExtendedContentDescription
extends Chunk
implements WriteableChunk

This structure represents the data of a chunk, which contains extended content description.
These properties are simply represented by ContentDescriptor

Author:
Christian Laireiter

Constructor Summary
ExtendedContentDescription()
          Creates an instance.
ExtendedContentDescription(java.math.BigInteger chunkLen)
          Creates an instance.
 
Method Summary
 void addDescriptor(ContentDescriptor toAdd)
          This method inserts the given ContentDescriptor.
 void addOrReplace(ContentDescriptor descriptor)
          This method adds or replaces an existing content descriptor.
 boolean containsDescriptor(java.lang.String fieldName)
          Looks if the given fieldName is already contained in this descriptor.
 long getCurrentAsfChunkSize()
          This method calculates the total amount of bytes, the chunk would consume in an ASF file.
 int getDescriptorCount()
           
 java.util.List<ContentDescriptor> getDescriptors()
          Returns a list of all ContentDescriptorobjects stored in this extended content description.
 java.util.List<ContentDescriptor> getDescriptors(java.lang.String name)
          Returns a previously inserted content descriptors.
 boolean isEmpty()
          true if it is not necessary to write the chunk into an ASF file, since it contains no information.
 java.lang.String prettyPrint(java.lang.String prefix)
          This method creates a String containing useful information prepared to be printed on STD-OUT.
 java.util.List<ContentDescriptor> remove(java.lang.String id)
          This method removes the content descriptor with the given name.
 long writeInto(java.io.OutputStream out)
          Writes the chunk into the specified output stream, as ASF stream chunk.
 
Methods inherited from class org.jaudiotagger.audio.asf.data.Chunk
getChunckEnd, getChunkLength, getGuid, getPosition, setPosition, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jaudiotagger.audio.asf.io.WriteableChunk
getGuid
 

Constructor Detail

ExtendedContentDescription

public ExtendedContentDescription()
Creates an instance.


ExtendedContentDescription

public ExtendedContentDescription(java.math.BigInteger chunkLen)
Creates an instance.

Parameters:
chunkLen - Length of the represented chunck.
Method Detail

addDescriptor

public void addDescriptor(ContentDescriptor toAdd)
This method inserts the given ContentDescriptor.

Parameters:
toAdd - ContentDescriptor to insert.

addOrReplace

public void addOrReplace(ContentDescriptor descriptor)
This method adds or replaces an existing content descriptor.

Parameters:
descriptor - Descriptor to be added or replaced.

containsDescriptor

public boolean containsDescriptor(java.lang.String fieldName)
Looks if the given fieldName is already contained in this descriptor.

Parameters:
fieldName - name of the field to look for.
Returns:
true if a descriptor with the name is contained.

getCurrentAsfChunkSize

public long getCurrentAsfChunkSize()
This method calculates the total amount of bytes, the chunk would consume in an ASF file.

Specified by:
getCurrentAsfChunkSize in interface WriteableChunk
Returns:
amount of bytes the chunk would currently need in an ASF file.

getDescriptorCount

public int getDescriptorCount()
Returns:
Returns the descriptorCount.

getDescriptors

public java.util.List<ContentDescriptor> getDescriptors()
Returns a list of all ContentDescriptorobjects stored in this extended content description.

Returns:
A listing of ContentDescriptorobjects.

getDescriptors

public java.util.List<ContentDescriptor> getDescriptors(java.lang.String name)
Returns a previously inserted content descriptors.

Parameters:
name - name of the content descriptor.
Returns:
null if not present.

isEmpty

public boolean isEmpty()
true if it is not necessary to write the chunk into an ASF file, since it contains no information.

Specified by:
isEmpty in interface WriteableChunk
Returns:
true if no useful data will be preserved.

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 Chunk
Parameters:
prefix - each line gets this string prepended.
Returns:
Information of current Chunk Object.

remove

public java.util.List<ContentDescriptor> remove(java.lang.String id)
This method removes the content descriptor with the given name.

Parameters:
id - The id (name) of the descriptor which should be removed.
Returns:
The descriptors which are removed. If not present null.

writeInto

public long writeInto(java.io.OutputStream out)
               throws java.io.IOException
Writes the chunk into the specified output stream, as ASF stream chunk.

Specified by:
writeInto in interface WriteableChunk
Parameters:
out - stream to write into.
Returns:
amount of bytes written.
Throws:
java.io.IOException - on I/O errors