FileDocCategorySizeDatePackage
Mp4TagBinaryField.javaAPI DocJaudiotagger 2.0.43925Wed Mar 30 16:12:10 BST 2011org.jaudiotagger.tag.mp4.field

Mp4TagBinaryField

public class Mp4TagBinaryField extends org.jaudiotagger.tag.mp4.Mp4TagField
Represents binary data

Subclassed by cover art field, TODO unaware of any other binary fields at the moment

Fields Summary
protected int
dataSize
protected byte[]
dataBytes
protected boolean
isBinary
Constructors Summary
public Mp4TagBinaryField(String id)
Construct an empty Binary Field

param
id


                
      
    
        super(id);
    
public Mp4TagBinaryField(String id, byte[] data)
Construct new binary field with binarydata provided

param
id
param
data
throws
UnsupportedEncodingException

        super(id);
        this.dataBytes = data;
    
public Mp4TagBinaryField(String id, ByteBuffer raw)
Construct binary field from rawdata of audio file

param
id
param
raw
throws
UnsupportedEncodingException

        super(id, raw);
    
Methods Summary
protected voidbuild(java.nio.ByteBuffer raw)

        Mp4BoxHeader header = new Mp4BoxHeader(raw);
        dataSize = header.getDataLength();

        //Skip the version and length fields
        raw.position(raw.position() + Mp4DataBox.PRE_DATA_LENGTH);

        //Read the raw data into byte array
        this.dataBytes = new byte[dataSize - Mp4DataBox.PRE_DATA_LENGTH];
        for (int i = 0; i < dataBytes.length; i++)
        {
            this.dataBytes[i] = raw.get();
        }

        //After returning buffers position will be after the end of this atom
    
public voidcopyContent(org.jaudiotagger.tag.TagField field)

        if (field instanceof Mp4TagBinaryField)
        {
            this.dataBytes = ((Mp4TagBinaryField) field).getData();
            this.isBinary = field.isBinary();
        }
    
public byte[]getData()

        return this.dataBytes;
    
protected byte[]getDataBytes()
Used when creating raw content

return
throws
UnsupportedEncodingException

        return dataBytes;
    
public intgetDataSize()

        return dataSize;

    
public Mp4FieldTypegetFieldType()

        //TODO dont know what value this should be do we actually have any binary fields other
        //than cover art
        return Mp4FieldType.IMPLICIT;
    
public booleanisBinary()

        return isBinary;
    
public booleanisEmpty()

        return this.dataBytes.length == 0;
    
public voidsetData(byte[] d)

        this.dataBytes = d;