entagged.audioformats.asf.data
Class ContentDescriptor

java.lang.Object
  extended by entagged.audioformats.asf.data.ContentDescriptor
All Implemented Interfaces:
Comparable

public final class ContentDescriptor
extends Object
implements Comparable

This class is a wrapper for properties within a ExtendedContentDescription.

Author:
Christian Laireiter

Field Summary
static HashSet COMMON_FIELD_IDS
          This field stores all values of the "ID_"-constants.
protected  byte[] content
          The binary representation of the value.
static String ID_ALBUM
          This constant gives the common id (name) for the "album" field in an asf extended content description.
static String ID_ARTIST
          This constant gives the common id (name) for the "artist" field in an asf extended content description.
static String ID_GENRE
          This constant gives the common id (name) for the "genre" field in an asf extended content description.
static String ID_GENREID
          This constant gives the common id (name) for the "genre Id" field in an asf extended content description.
static String ID_TRACKNUMBER
          This constant gives the common id (name) for the "track number" field in an asf extended content description.
static String ID_YEAR
          This constant gives the common id (name) for the "year" field in an asf extended content description.
static int TYPE_BINARY
          Constant for the content descriptor-type for binary data.
static int TYPE_BOOLEAN
          Constant for the content descriptor-type for booleans.
static int TYPE_DWORD
          Constant for the content descriptor-type for integers (32-bit).
static int TYPE_QWORD
          Constant for the content descriptor-type for integers (64-bit).
static int TYPE_STRING
          Constant for the content descriptor-type for Strings.
static int TYPE_WORD
          Constant for the content descriptor-type for integers (16-bit).
 
Constructor Summary
ContentDescriptor(String propName, int propType)
          Creates an Instance.
 
Method Summary
 Object clone()
          (overridden)
 int compareTo(Object o)
          (overridden)
 ContentDescriptor createCopy()
          This mehtod creates a copy of the current object.
 boolean equals(Object obj)
          (overridden)
 boolean getBoolean()
          Returns the value of the ContentDescriptor as a Boolean.
 byte[] getBytes()
          This method will return a byte array, which can directly be written into an "Extended Content Description"-chunk.
 String getName()
          This method returns the name of the content descriptor.
 long getNumber()
          This method returns the value of the content descriptor as an integer.
 byte[] getRawData()
          This method returns a copy of the content of the descriptor.
 String getString()
          Returns the value of the ContentDescriptor as a String.
 int getType()
          Returns the type of the content descriptor.
 boolean isCommon()
          This method checks whether the name of the current field is one of the commonly specified fields.
 boolean isEmpty()
          This method checks if the binary data is empty.
 void setBinaryValue(byte[] data)
          Sets the Value of the current content descriptor.
 void setBooleanValue(boolean value)
          Sets the Value of the current content descriptor.
 void setDWordValue(long value)
          Sets the Value of the current content descriptor.
 void setQWordValue(long value)
          Sets the Value of the current content descriptor.
 void setStringValue(String value)
          Sets the Value of the current content descriptor.
 void setWordValue(int value)
          Sets the Value of the current content descriptor.
 String toString()
          (overridden)
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMON_FIELD_IDS

public static final HashSet COMMON_FIELD_IDS
This field stores all values of the "ID_"-constants.


ID_ALBUM

public static final String ID_ALBUM
This constant gives the common id (name) for the "album" field in an asf extended content description.

See Also:
Constant Field Values

ID_ARTIST

public static final String ID_ARTIST
This constant gives the common id (name) for the "artist" field in an asf extended content description.

See Also:
Constant Field Values

ID_GENRE

public static final String ID_GENRE
This constant gives the common id (name) for the "genre" field in an asf extended content description.

See Also:
Constant Field Values

ID_GENREID

public static final String ID_GENREID
This constant gives the common id (name) for the "genre Id" field in an asf extended content description.

See Also:
Constant Field Values

ID_TRACKNUMBER

public static final String ID_TRACKNUMBER
This constant gives the common id (name) for the "track number" field in an asf extended content description.

See Also:
Constant Field Values

ID_YEAR

public static final String ID_YEAR
This constant gives the common id (name) for the "year" field in an asf extended content description.

See Also:
Constant Field Values

TYPE_BINARY

public static final int TYPE_BINARY
Constant for the content descriptor-type for binary data.

See Also:
Constant Field Values

TYPE_BOOLEAN

public static final int TYPE_BOOLEAN
Constant for the content descriptor-type for booleans.

See Also:
Constant Field Values

TYPE_DWORD

public static final int TYPE_DWORD
Constant for the content descriptor-type for integers (32-bit).

See Also:
Constant Field Values

TYPE_QWORD

public static final int TYPE_QWORD
Constant for the content descriptor-type for integers (64-bit).

See Also:
Constant Field Values

TYPE_STRING

public static final int TYPE_STRING
Constant for the content descriptor-type for Strings.

See Also:
Constant Field Values

TYPE_WORD

public static final int TYPE_WORD
Constant for the content descriptor-type for integers (16-bit).

See Also:
Constant Field Values

content

protected byte[] content
The binary representation of the value.

Constructor Detail

ContentDescriptor

public ContentDescriptor(String propName,
                         int propType)
Creates an Instance.

Parameters:
propName - Name of the ContentDescriptor.
propType - Type of the content descriptor. See descriptorType
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
(overridden)

Overrides:
clone in class Object
Throws:
CloneNotSupportedException
See Also:
Object.clone()

compareTo

public int compareTo(Object o)
(overridden)

Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

createCopy

public ContentDescriptor createCopy()
This mehtod creates a copy of the current object.
All data will be copied, too.

Returns:
A new Contentdescriptor containing the same values as the current one.

equals

public boolean equals(Object obj)
(overridden)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getBoolean

public boolean getBoolean()
Returns the value of the ContentDescriptor as a Boolean.
If no Conversion is Possible false is returned.
true if first byte of contentis not zero.

Returns:
boolean representation of the current value.

getBytes

public byte[] getBytes()
This method will return a byte array, which can directly be written into an "Extended Content Description"-chunk.

Returns:
byte[] with the data, that occurs in asf files.

getName

public String getName()
This method returns the name of the content descriptor.

Returns:
Name.

getNumber

public long getNumber()
This method returns the value of the content descriptor as an integer.
Converts the needed amount of byte out of contentto a number.
Only possible if getType()equals on of the following:
  • Returns:
    integer value.
    See Also:
  • ,
  • ,
  • ,

  • getRawData

    public byte[] getRawData()
    This method returns a copy of the content of the descriptor.

    Returns:
    The content in binary representation, as it would be written to asf file.

    getString

    public String getString()
    Returns the value of the ContentDescriptor as a String.

    Returns:
    String - Representation Value

    getType

    public int getType()
    Returns the type of the content descriptor.

    Returns:
    the value of descriptorType
    See Also:
    TYPE_BINARY, TYPE_BOOLEAN, TYPE_DWORD, TYPE_QWORD, TYPE_STRING, TYPE_WORD

    isCommon

    public boolean isCommon()
    This method checks whether the name of the current field is one of the commonly specified fields.

    Returns:
    true if a common field.
    See Also:
    ID_ALBUM, ID_GENRE, ID_GENREID, ID_TRACKNUMBER, ID_YEAR

    isEmpty

    public boolean isEmpty()
    This method checks if the binary data is empty.
    Disregarding the type of the descriptor its content is stored as a byte array.

    Returns:
    true if no value is set.

    setBinaryValue

    public void setBinaryValue(byte[] data)
                        throws IllegalArgumentException
    Sets the Value of the current content descriptor.
    Using this method will change descriptorTypeto TYPE_BINARY.

    Parameters:
    data - Value to set.
    Throws:
    IllegalArgumentException - If the byte array is greater that 65535 bytes.

    setBooleanValue

    public void setBooleanValue(boolean value)
    Sets the Value of the current content descriptor.
    Using this method will change descriptorTypeto TYPE_BOOLEAN.

    Parameters:
    value - Value to set.

    setDWordValue

    public void setDWordValue(long value)
    Sets the Value of the current content descriptor.
    Using this method will change descriptorTypeto TYPE_DWORD.

    Parameters:
    value - Value to set.

    setQWordValue

    public void setQWordValue(long value)
    Sets the Value of the current content descriptor.
    Using this method will change descriptorTypeto TYPE_QWORD

    Parameters:
    value - Value to set.

    setStringValue

    public void setStringValue(String value)
                        throws IllegalArgumentException
    Sets the Value of the current content descriptor.
    Using this method will change descriptorTypeto TYPE_STRING.

    Parameters:
    value - Value to set.
    Throws:
    IllegalArgumentException - If byte representation would take more than 65535 Bytes.

    setWordValue

    public void setWordValue(int value)
    Sets the Value of the current content descriptor.
    Using this method will change descriptorTypeto TYPE_WORD

    Parameters:
    value - Value to set.

    toString

    public String toString()
    (overridden)

    Overrides:
    toString in class Object
    See Also:
    Object.toString()


    Copyright © 2007-2008. All Rights Reserved.