|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.asf.data.MetadataDescriptor
public class MetadataDescriptor
This structure represents metadata objects in ASF MetadataContainer
.
The values are
checked against the capability introduced by the given
ContainerType
at construction.
Limitation: Even though some container types do not restrict the data
size to Integer.MAX_VALUE
, this implementation does it (due to java
nature).
2 GiB of data should suffice, and even be to large for normal java heap.
Field Summary | |
---|---|
private ContainerType |
containerType
Stores the containerType of the descriptor. |
private byte[] |
content
The binary representation of the value. |
private int |
descriptorType
This field shows the type of the metadata descriptor. |
static long |
DWORD_MAXVALUE
Maximum value for WORD. |
private int |
languageIndex
the index of the language in the language list this descriptor applies to. |
private static java.util.logging.Logger |
LOGGER
Logger instance. |
static int |
MAX_LANG_INDEX
The maximum language index allowed. |
static int |
MAX_STREAM_NUMBER
Maximum stream number. |
private java.lang.String |
name
The name of the metadata descriptor. |
static java.math.BigInteger |
QWORD_MAXVALUE
Maximum value for a QWORD value (64 bit unsigned). |
private int |
streamNumber
The number of the stream, this descriptor applies to. |
static int |
TYPE_BINARY
Constant for the metadata descriptor-type for binary data. |
static int |
TYPE_BOOLEAN
Constant for the metadata descriptor-type for booleans. |
static int |
TYPE_DWORD
Constant for the metadata descriptor-type for DWORD (32-bit unsigned). |
static int |
TYPE_GUID
Constant for the metadata descriptor-type for GUIDs (128-bit). |
static int |
TYPE_QWORD
Constant for the metadata descriptor-type for QWORD (64-bit unsinged). |
static int |
TYPE_STRING
Constant for the metadata descriptor-type for Strings. |
static int |
TYPE_WORD
Constant for the metadata descriptor-type for WORD (16-bit unsigned). |
static int |
WORD_MAXVALUE
Maximum value for WORD. |
Constructor Summary | |
---|---|
MetadataDescriptor(ContainerType type,
java.lang.String propName,
int propType)
Creates an Instance. |
|
MetadataDescriptor(ContainerType type,
java.lang.String propName,
int propType,
int stream,
int language)
Creates an Instance. |
|
MetadataDescriptor(java.lang.String propName)
Creates an instance. Capabilities are set to ContainerType.METADATA_LIBRARY_OBJECT . |
|
MetadataDescriptor(java.lang.String propName,
int propType)
Creates an Instance. Capabilities are set to ContainerType.METADATA_LIBRARY_OBJECT . |
Method Summary | |
---|---|
java.math.BigInteger |
asNumber()
Converts the descriptors value into a number if possible. A boolean will be converted to "1" if true ,
otherwise "0".String will be interpreted as number with radix "10". Binary data will be interpreted as the default WORD,DWORD or QWORD binary representation, but only if the data does not exceed 8 bytes. |
java.lang.Object |
clone()
(overridden) |
int |
compareTo(MetadataDescriptor other)
|
MetadataDescriptor |
createCopy()
This method creates a copy of the current object. |
boolean |
equals(java.lang.Object obj)
(overridden) |
boolean |
getBoolean()
Returns the value of the MetadataDescriptor as a Boolean. |
byte[] |
getBytes()
Deprecated. writeInto(OutputStream,ContainerType) is used |
ContainerType |
getContainerType()
Returns the container type this descriptor ist restricted to. |
int |
getCurrentAsfSize(ContainerType type)
Returns the size (in bytes) this descriptor will take when written to an ASF file. |
GUID |
getGuid()
Returns the GUID value, if content could represent one. |
int |
getLanguageIndex()
Returns the index of the language that is referred (see LanguageList ): |
java.lang.String |
getName()
This method returns the name of the metadata descriptor. |
long |
getNumber()
This method returns the value of the metadata descriptor as a long. |
byte[] |
getRawData()
This method returns a copy of the content of the descriptor. |
int |
getRawDataSize()
Returns the size (in bytes) the binary representation of the content uses. |
int |
getStreamNumber()
Returns the stream number this descriptor applies to. |
java.lang.String |
getString()
Returns the value of the MetadataDescriptor as a String. |
int |
getType()
Returns the type of the metadata descriptor. |
int |
hashCode()
|
boolean |
isEmpty()
This method checks if the binary data is empty. |
void |
setBinaryValue(byte[] data)
Sets the Value of the current metadata descriptor. |
void |
setBooleanValue(boolean value)
Sets the Value of the current metadata descriptor. |
void |
setDWordValue(long value)
Sets the Value of the current metadata descriptor. |
void |
setGUIDValue(GUID value)
Sets the value of the metadata descriptor. Using this method will change descriptorType to
TYPE_GUID |
void |
setLanguageIndex(int language)
Sets the index of the referred language (see LanguageList ).Consider: The requirements must be held. |
void |
setQWordValue(java.math.BigInteger value)
Sets the Value of the current metadata descriptor. |
void |
setQWordValue(long value)
Sets the Value of the current metadata descriptor. |
void |
setStreamNumber(int stream)
Sets the stream number the descriptor applies to. Consider: The requirements must be held. |
void |
setString(java.lang.String value)
This method converts the given string value into the current data type. |
void |
setStringValue(java.lang.String value)
Sets the Value of the current metadata descriptor. |
void |
setWordValue(int value)
Sets the Value of the current metadata descriptor. |
java.lang.String |
toString()
(overridden) |
int |
writeInto(java.io.OutputStream out,
ContainerType contType)
Writes this descriptor into the specified output stream. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long DWORD_MAXVALUE
private static final java.util.logging.Logger LOGGER
public static final int MAX_LANG_INDEX
public static final int MAX_STREAM_NUMBER
public static final java.math.BigInteger QWORD_MAXVALUE
public static final int TYPE_BINARY
public static final int TYPE_BOOLEAN
public static final int TYPE_DWORD
public static final int TYPE_GUID
public static final int TYPE_QWORD
public static final int TYPE_STRING
public static final int TYPE_WORD
public static final int WORD_MAXVALUE
private final ContainerType containerType
private byte[] content
private int descriptorType
TYPE_BINARY
,
TYPE_BOOLEAN
,
TYPE_DWORD
,
TYPE_GUID
,
TYPE_QWORD
,
TYPE_STRING
,
TYPE_WORD
private int languageIndex
private final java.lang.String name
private int streamNumber
Constructor Detail |
---|
public MetadataDescriptor(ContainerType type, java.lang.String propName, int propType)
type
- the container type, this descriptor is resctricted to.propName
- Name of the MetadataDescriptor.propType
- Type of the metadata descriptor. See descriptorType
public MetadataDescriptor(ContainerType type, java.lang.String propName, int propType, int stream, int language)
type
- The container type the values (the whole descriptor) is
restricted to.propName
- Name of the MetadataDescriptor.propType
- Type of the metadata descriptor. See descriptorType
stream
- the number of the stream the descriptor refers to.language
- the index of the language entry in a LanguageList
this
descriptor refers to.public MetadataDescriptor(java.lang.String propName)
ContainerType.METADATA_LIBRARY_OBJECT
.
propName
- name of the metadata descriptor.public MetadataDescriptor(java.lang.String propName, int propType)
ContainerType.METADATA_LIBRARY_OBJECT
.
propName
- Name of the MetadataDescriptor.propType
- Type of the metadata descriptor. See descriptorType
Method Detail |
---|
public java.math.BigInteger asNumber()
true
,
otherwise "0".
java.lang.NumberFormatException
- If no conversion is supported.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
Object.clone()
public int compareTo(MetadataDescriptor other)
compareTo
in interface java.lang.Comparable<MetadataDescriptor>
public MetadataDescriptor createCopy()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public boolean getBoolean()
true
if first byte of content
is not zero.
@Deprecated public byte[] getBytes()
writeInto(OutputStream,ContainerType)
is used
public ContainerType getContainerType()
public int getCurrentAsfSize(ContainerType type)
type
- the container type for which the size is calculated.
public GUID getGuid()
public int getLanguageIndex()
LanguageList
):
public java.lang.String getName()
public long getNumber()
content
to a number. getType()
equals on of the following:
public byte[] getRawData()
public int getRawDataSize()
getRawData()
)
public int getStreamNumber()
public java.lang.String getString()
public int getType()
descriptorType
TYPE_BINARY
,
TYPE_BOOLEAN
,
TYPE_DWORD
,
TYPE_GUID
,
TYPE_QWORD
,
TYPE_STRING
,
TYPE_WORD
public int hashCode()
hashCode
in class java.lang.Object
public boolean isEmpty()
true
if no value is set.public void setBinaryValue(byte[] data) throws java.lang.IllegalArgumentException
descriptorType
to
TYPE_BINARY
.
data
- Value to set.
java.lang.IllegalArgumentException
- if data is invalid for container.public void setBooleanValue(boolean value)
descriptorType
to
TYPE_BOOLEAN
.
value
- Value to set.public void setDWordValue(long value)
descriptorType
to
TYPE_DWORD
.
value
- Value to set.public void setGUIDValue(GUID value)
descriptorType
to
TYPE_GUID
value
- value to set.public void setLanguageIndex(int language)
LanguageList
).
language
- the language index to setpublic void setQWordValue(java.math.BigInteger value) throws java.lang.IllegalArgumentException
descriptorType
to
TYPE_QWORD
value
- Value to set.
java.lang.NumberFormatException
- on null
values.
java.lang.IllegalArgumentException
- on illegal values or values exceeding range.public void setQWordValue(long value)
descriptorType
to
TYPE_QWORD
value
- Value to set.public void setStreamNumber(int stream)
stream
- the stream number to setpublic void setString(java.lang.String value) throws java.lang.IllegalArgumentException
value
- value to set.
java.lang.IllegalArgumentException
- If conversion was impossible.public void setStringValue(java.lang.String value) throws java.lang.IllegalArgumentException
descriptorType
to
TYPE_STRING
.
value
- Value to set.
java.lang.IllegalArgumentException
- If byte representation would take more than 65535 Bytes.public void setWordValue(int value) throws java.lang.IllegalArgumentException
descriptorType
to
TYPE_WORD
value
- Value to set.
java.lang.IllegalArgumentException
- on negative values. ASF just supports unsigned values.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int writeInto(java.io.OutputStream out, ContainerType contType) throws java.io.IOException
out
- stream to write into.contType
- the container type this descriptor is written to.
java.io.IOException
- on I/O Errors
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |