org.jaudiotagger.audio.asf.data
Enum ContainerType

java.lang.Object
  extended by java.lang.Enum<ContainerType>
      extended by org.jaudiotagger.audio.asf.data.ContainerType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ContainerType>

public enum ContainerType
extends java.lang.Enum<ContainerType>

Enumerates capabilities, respectively uses, of metadata descriptors.

The METADATA_LIBRARY_OBJECT allows the most variations of data, as well as no size limitation (if it can be stored within a DWORD amount of bytes).

Author:
Christian Laireiter

Enum Constant Summary
CONTENT_BRANDING
          The descriptor is used in the content branding object (chunk)
CONTENT_DESCRIPTION
          The descriptor is used in the content description object (chunk), so maximum data length applies, no language index and stream number are allowed, as well as no multiple values.
EXTENDED_CONTENT
          The descriptor is used in an extended content description object, so the maximum data size applies, and no language index and stream number other than "0" is allowed.
METADATA_LIBRARY_OBJECT
          The descriptor is used in a metadata library object.
METADATA_OBJECT
          The descriptor is used in a metadata object.
 
Field Summary
private  GUID containerGUID
          Stores the guid that identifies ASF chunks which store metadata of the current type.
private  boolean guidEnabled
          true if the descriptor field can store GUID values.
private  boolean languageEnabled
          true if descriptor field can refer to a language.
private  java.math.BigInteger maximumDataLength
          The maximum amount of bytes the descriptor data may consume.
private  boolean multiValued
          true if the container may store multiple values of the same metadata descriptor specification (equality on name, language, and stream).
WindowsMedia players advanced tag editor for example stores the WM/Picture attribute once in the extended content description, and all others in the metadata library object.
private  long perfMaxDataLen
          if -1 a size value has to be compared against maximumDataLength because Long.MAX_VALUE is exceeded.
Otherwise this is the BigInteger.longValue() representation.
private  boolean streamEnabled
          true if descriptor field can refer to specific streams.
 
Method Summary
static boolean areInCorrectOrder(ContainerType low, ContainerType high)
          Determines if low has <= index as high, in respect to getOrdered()
 void assertConstraints(java.lang.String name, byte[] data, int type, int stream, int language)
          Calls checkConstraints(String, byte[], int, int, int) and actually throws the exception if there is one.
 java.lang.RuntimeException checkConstraints(java.lang.String name, byte[] data, int type, int stream, int language)
          Checks if the values for a content descriptor match the contraints of the container type, and returns a RuntimeException if the requirements aren't met.
 GUID getContainerGUID()
           
 java.math.BigInteger getMaximumDataLength()
           
static ContainerType[] getOrdered()
          Returns the elements in an order, that indicates more capabilities (ascending).
 boolean isGuidEnabled()
           
 boolean isLanguageEnabled()
           
 boolean isMultiValued()
           
 boolean isStreamNumberEnabled()
           
 boolean isWithinValueRange(long value)
          Tests if the given value is less than or equal to getMaximumDataLength(), and greater or equal to zero.
static ContainerType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ContainerType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CONTENT_BRANDING

public static final ContainerType CONTENT_BRANDING
The descriptor is used in the content branding object (chunk)


CONTENT_DESCRIPTION

public static final ContainerType CONTENT_DESCRIPTION
The descriptor is used in the content description object (chunk), so maximum data length applies, no language index and stream number are allowed, as well as no multiple values.


EXTENDED_CONTENT

public static final ContainerType EXTENDED_CONTENT
The descriptor is used in an extended content description object, so the maximum data size applies, and no language index and stream number other than "0" is allowed. Additionally no multiple values are permitted.


METADATA_LIBRARY_OBJECT

public static final ContainerType METADATA_LIBRARY_OBJECT
The descriptor is used in a metadata library object. No real size limit (except DWORD range) applies. Stream numbers and language indexes can be specified.


METADATA_OBJECT

public static final ContainerType METADATA_OBJECT
The descriptor is used in a metadata object. The maximum data size applies. Stream numbers can be specified. But no language index (always "0").

Field Detail

containerGUID

private final GUID containerGUID
Stores the guid that identifies ASF chunks which store metadata of the current type.


guidEnabled

private final boolean guidEnabled
true if the descriptor field can store GUID values.


languageEnabled

private final boolean languageEnabled
true if descriptor field can refer to a language.


maximumDataLength

private final java.math.BigInteger maximumDataLength
The maximum amount of bytes the descriptor data may consume.


multiValued

private final boolean multiValued
true if the container may store multiple values of the same metadata descriptor specification (equality on name, language, and stream).
WindowsMedia players advanced tag editor for example stores the WM/Picture attribute once in the extended content description, and all others in the metadata library object.


perfMaxDataLen

private final long perfMaxDataLen
if -1 a size value has to be compared against maximumDataLength because Long.MAX_VALUE is exceeded.
Otherwise this is the BigInteger.longValue() representation.


streamEnabled

private final boolean streamEnabled
true if descriptor field can refer to specific streams.

Method Detail

values

public static ContainerType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ContainerType c : ContainerType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ContainerType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

areInCorrectOrder

public static boolean areInCorrectOrder(ContainerType low,
                                        ContainerType high)
Determines if low has <= index as high, in respect to getOrdered()

Parameters:
low -
high -
Returns:
true if in correct order.

getOrdered

public static ContainerType[] getOrdered()
Returns the elements in an order, that indicates more capabilities (ascending).

Returns:
capability ordered types

assertConstraints

public void assertConstraints(java.lang.String name,
                              byte[] data,
                              int type,
                              int stream,
                              int language)
Calls checkConstraints(String, byte[], int, int, int) and actually throws the exception if there is one.

Parameters:
name - name of the descriptor
data - content
type - data type
stream - stream number
language - language index

checkConstraints

public java.lang.RuntimeException checkConstraints(java.lang.String name,
                                                   byte[] data,
                                                   int type,
                                                   int stream,
                                                   int language)
Checks if the values for a content descriptor match the contraints of the container type, and returns a RuntimeException if the requirements aren't met.

Parameters:
name - name of the descriptor
data - content
type - data type
stream - stream number
language - language index
Returns:
null if everything is fine.

getContainerGUID

public GUID getContainerGUID()
Returns:
the containerGUID

getMaximumDataLength

public java.math.BigInteger getMaximumDataLength()
Returns:
the maximumDataLength

isGuidEnabled

public boolean isGuidEnabled()
Returns:
the guidEnabled

isLanguageEnabled

public boolean isLanguageEnabled()
Returns:
the languageEnabled

isWithinValueRange

public boolean isWithinValueRange(long value)
Tests if the given value is less than or equal to getMaximumDataLength(), and greater or equal to zero.

Parameters:
value - The value to test
Returns:
true if size restrictions for binary data are met with this container type.

isMultiValued

public boolean isMultiValued()
Returns:
the multiValued

isStreamNumberEnabled

public boolean isStreamNumberEnabled()
Returns:
the streamEnabled