org.jaudiotagger.tag.datatype
Class NumberFixedLength

java.lang.Object
  extended by org.jaudiotagger.tag.datatype.AbstractDataType
      extended by org.jaudiotagger.tag.datatype.NumberFixedLength
Direct Known Subclasses:
NumberHashMap

public class NumberFixedLength
extends AbstractDataType

Represents a number held as a fixed number of digits.

The bitorder in ID3v2 is most significant bit first (MSB). The byteorder in multibyte numbers is most significant byte first (e.g. $12345678 would be encoded $12 34 56 78), also known as big endian and network byte order.

In ID3Specification would be denoted as $xx xx this denotes exactly two bytes required


Field Summary
 
Fields inherited from class org.jaudiotagger.tag.datatype.AbstractDataType
frameBody, identifier, logger, size, TYPE_ELEMENT, value
 
Constructor Summary
NumberFixedLength(NumberFixedLength copy)
           
NumberFixedLength(java.lang.String identifier, AbstractTagFrameBody frameBody, int size)
          Creates a new ObjectNumberFixedLength datatype.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getSize()
          Return size
 void readByteArray(byte[] arr, int offset)
          Read the number from the byte array
 void setSize(int size)
          Set Size in Bytes of this Object
 void setValue(java.lang.Object value)
          Set the value held by this datatype, this is used typically used when the user wants to modify the value in an existing frame.
 java.lang.String toString()
           
 byte[] writeByteArray()
          Write data to byte array
 
Methods inherited from class org.jaudiotagger.tag.datatype.AbstractDataType
createStructure, getBody, getIdentifier, getValue, readByteArray, setBody
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumberFixedLength

public NumberFixedLength(java.lang.String identifier,
                         AbstractTagFrameBody frameBody,
                         int size)
Creates a new ObjectNumberFixedLength datatype.

Parameters:
identifier -
frameBody -
size - the number of significant places that the number is held to
Throws:
java.lang.IllegalArgumentException

NumberFixedLength

public NumberFixedLength(NumberFixedLength copy)
Method Detail

setSize

public void setSize(int size)
Set Size in Bytes of this Object

Parameters:
size - in bytes that this number will be held as

getSize

public int getSize()
Return size

Specified by:
getSize in class AbstractDataType
Returns:
the size of this number

setValue

public void setValue(java.lang.Object value)
Description copied from class: AbstractDataType
Set the value held by this datatype, this is used typically used when the user wants to modify the value in an existing frame.

Overrides:
setValue in class AbstractDataType

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AbstractDataType
Parameters:
obj -
Returns:
true if obj equivalent to this

readByteArray

public void readByteArray(byte[] arr,
                          int offset)
                   throws InvalidDataTypeException
Read the number from the byte array

Specified by:
readByteArray in class AbstractDataType
Parameters:
arr -
offset -
Throws:
java.lang.NullPointerException
java.lang.IndexOutOfBoundsException
InvalidDataTypeException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String representation of this datatype

writeByteArray

public byte[] writeByteArray()
Write data to byte array

Specified by:
writeByteArray in class AbstractDataType
Returns:
the datatype converted to a byte array