org.jaudiotagger.tag.mp4.field
Class Mp4TagByteField

java.lang.Object
  extended by org.jaudiotagger.tag.mp4.Mp4TagField
      extended by org.jaudiotagger.tag.mp4.field.Mp4TagTextField
          extended by org.jaudiotagger.tag.mp4.field.Mp4TagByteField
All Implemented Interfaces:
TagField, TagTextField

public class Mp4TagByteField
extends Mp4TagTextField

Represents a single byte as a number

Usually single byte fields are used as a boolean field, but not always so we dont do this conversion


Field Summary
private  byte[] bytedata
           
private  int realDataLength
           
static java.lang.String TRUE_VALUE
           
 
Fields inherited from class org.jaudiotagger.tag.mp4.field.Mp4TagTextField
content, dataSize
 
Fields inherited from class org.jaudiotagger.tag.mp4.Mp4TagField
id, logger, parentHeader
 
Constructor Summary
Mp4TagByteField(Mp4FieldKey id, java.lang.String value)
          Create new field

Assume length of 1 which is correct for most but not all byte fields

Mp4TagByteField(Mp4FieldKey id, java.lang.String value, int realDataLength)
          Create new field with known length
Mp4TagByteField(java.lang.String id, java.nio.ByteBuffer raw)
          Construct from rawdata from audio file
 
Method Summary
protected  void build(java.nio.ByteBuffer data)
          Processes the data and sets the position of the data buffer to just after the end of this fields data ready for processing next field.
protected  byte[] getDataBytes()
          Return raw data bytes

TODO this code should be done better so generalised to any length

 Mp4FieldType getFieldType()
           
 
Methods inherited from class org.jaudiotagger.tag.mp4.field.Mp4TagTextField
copyContent, getContent, getEncoding, isBinary, isEmpty, setContent, setEncoding, toString
 
Methods inherited from class org.jaudiotagger.tag.mp4.Mp4TagField
getId, getIdBytes, getRawContent, getRawContentDataOnly, isBinary, isCommon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jaudiotagger.tag.TagField
getId, getRawContent, isBinary, isCommon
 

Field Detail

TRUE_VALUE

public static java.lang.String TRUE_VALUE

realDataLength

private int realDataLength

bytedata

private byte[] bytedata
Constructor Detail

Mp4TagByteField

public Mp4TagByteField(Mp4FieldKey id,
                       java.lang.String value)
                throws FieldDataInvalidException
Create new field

Assume length of 1 which is correct for most but not all byte fields

Parameters:
id -
value - is a String representation of a number
Throws:
FieldDataInvalidException

Mp4TagByteField

public Mp4TagByteField(Mp4FieldKey id,
                       java.lang.String value,
                       int realDataLength)
                throws FieldDataInvalidException
Create new field with known length

Parameters:
id -
value - is a String representation of a number
realDataLength -
Throws:
FieldDataInvalidException

Mp4TagByteField

public Mp4TagByteField(java.lang.String id,
                       java.nio.ByteBuffer raw)
                throws java.io.UnsupportedEncodingException
Construct from rawdata from audio file

Parameters:
id -
raw -
Throws:
java.io.UnsupportedEncodingException
Method Detail

getFieldType

public Mp4FieldType getFieldType()
Overrides:
getFieldType in class Mp4TagTextField
Returns:
the field type of this field

getDataBytes

protected byte[] getDataBytes()
                       throws java.io.UnsupportedEncodingException
Return raw data bytes

TODO this code should be done better so generalised to any length

Overrides:
getDataBytes in class Mp4TagTextField
Returns:
Throws:
java.io.UnsupportedEncodingException

build

protected void build(java.nio.ByteBuffer data)
              throws java.io.UnsupportedEncodingException
Description copied from class: Mp4TagField
Processes the data and sets the position of the data buffer to just after the end of this fields data ready for processing next field.

Overrides:
build in class Mp4TagTextField
Throws:
java.io.UnsupportedEncodingException