org.jaudiotagger.audio.asf.data
Class ContentDescription

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

public final class ContentDescription
extends MetadataContainer

This class represents the data of a chunk which contains title, author, copyright, description and the rating of the file.
It is optional within ASF files. But if, exists only once.

Author:
Christian Laireiter

Field Summary
static java.util.Set<java.lang.String> ALLOWED
          Stores the only allowed keys of this metadata container.
static java.lang.String KEY_AUTHOR
          Field key for author.
static java.lang.String KEY_COPYRIGHT
          Field key for copyright.
static java.lang.String KEY_DESCRIPTION
          Field key for description.
static java.lang.String KEY_RATING
          Field key for rating.
static java.lang.String KEY_TITLE
          Field key for title.
 
Fields inherited from class org.jaudiotagger.audio.asf.data.Chunk
chunkLength, guid, position
 
Constructor Summary
ContentDescription()
          Creates an instance.
ContentDescription(long pos, java.math.BigInteger chunkLen)
          Creates an instance.
 
Method Summary
 java.lang.String getAuthor()
           
 java.lang.String getComment()
           
 java.lang.String getCopyRight()
           
 long getCurrentAsfChunkSize()
          This method calculates the total amount of bytes, the chunk would consume in an ASF file.
 java.lang.String getRating()
           
 java.lang.String getTitle()
           
 boolean isAddSupported(MetadataDescriptor descriptor)
          Determines/checks if the given descriptor may be added to the container.
This implies a check for the capabilities of the container specified by its container type.
 java.lang.String prettyPrint(java.lang.String prefix)
          This method creates a String containing useful information prepared to be printed on STD-OUT.
 void setAuthor(java.lang.String fileAuthor)
           
 void setComment(java.lang.String tagComment)
           
 void setCopyright(java.lang.String cpright)
           
 void setRating(java.lang.String ratingText)
           
 void setTitle(java.lang.String songTitle)
           
 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.MetadataContainer
addDescriptor, assertDescriptor, assertDescriptor, containsDescriptor, getContainerType, getDescriptorCount, getDescriptors, getDescriptorsByName, getValueFor, hasDescriptor, isEmpty, removeDescriptorsByName, setStringValue
 
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
 
Methods inherited from interface org.jaudiotagger.audio.asf.io.WriteableChunk
getGuid
 

Field Detail

ALLOWED

public static final java.util.Set<java.lang.String> ALLOWED
Stores the only allowed keys of this metadata container.


KEY_AUTHOR

public static final java.lang.String KEY_AUTHOR
Field key for author.

See Also:
Constant Field Values

KEY_COPYRIGHT

public static final java.lang.String KEY_COPYRIGHT
Field key for copyright.

See Also:
Constant Field Values

KEY_DESCRIPTION

public static final java.lang.String KEY_DESCRIPTION
Field key for description.

See Also:
Constant Field Values

KEY_RATING

public static final java.lang.String KEY_RATING
Field key for rating.

See Also:
Constant Field Values

KEY_TITLE

public static final java.lang.String KEY_TITLE
Field key for title.

See Also:
Constant Field Values
Constructor Detail

ContentDescription

public ContentDescription()
Creates an instance.


ContentDescription

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

Parameters:
pos - Position of content description within file or stream
chunkLen - Length of content description.
Method Detail

getAuthor

public java.lang.String getAuthor()
Returns:
Returns the author.

getComment

public java.lang.String getComment()
Returns:
Returns the comment.

getCopyRight

public java.lang.String getCopyRight()
Returns:
Returns the copyRight.

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
Overrides:
getCurrentAsfChunkSize in class MetadataContainer
Returns:
amount of bytes the chunk would currently need in an ASF file.

getRating

public java.lang.String getRating()
Returns:
returns the rating.

getTitle

public java.lang.String getTitle()
Returns:
Returns the title.

isAddSupported

public boolean isAddSupported(MetadataDescriptor descriptor)
Determines/checks if the given descriptor may be added to the container.
This implies a check for the capabilities of the container specified by its container type.

Overrides:
isAddSupported in class MetadataContainer
Parameters:
descriptor - the descriptor to test.
Returns:
true if MetadataContainer.addDescriptor(MetadataDescriptor) can be called with given descriptor.

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

setAuthor

public void setAuthor(java.lang.String fileAuthor)
               throws java.lang.IllegalArgumentException
Parameters:
fileAuthor - The author to set.
Throws:
java.lang.IllegalArgumentException - If "UTF-16LE"-byte-representation would take more than 65535 bytes.

setComment

public void setComment(java.lang.String tagComment)
                throws java.lang.IllegalArgumentException
Parameters:
tagComment - The comment to set.
Throws:
java.lang.IllegalArgumentException - If "UTF-16LE"-byte-representation would take more than 65535 bytes.

setCopyright

public void setCopyright(java.lang.String cpright)
                  throws java.lang.IllegalArgumentException
Parameters:
cpright - The copyRight to set.
Throws:
java.lang.IllegalArgumentException - If "UTF-16LE"-byte-representation would take more than 65535 bytes.

setRating

public void setRating(java.lang.String ratingText)
               throws java.lang.IllegalArgumentException
Parameters:
ratingText - The rating to be set.
Throws:
java.lang.IllegalArgumentException - If "UTF-16LE"-byte-representation would take more than 65535 bytes.

setTitle

public void setTitle(java.lang.String songTitle)
              throws java.lang.IllegalArgumentException
Parameters:
songTitle - The title to set.
Throws:
java.lang.IllegalArgumentException - If "UTF-16LE"-byte-representation would take more than 65535 bytes.

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
Overrides:
writeInto in class MetadataContainer
Parameters:
out - stream to write into.
Returns:
amount of bytes written.
Throws:
java.io.IOException - on I/O errors