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

Mp4TagRawBinaryField

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

We use this when we find an atom under the ilst atom that we do not recognise , that does not follow standard conventions in order to save the data without modification so it can be safetly written back to file

Fields Summary
protected int
dataSize
protected byte[]
dataBytes
Constructors Summary
public Mp4TagRawBinaryField(org.jaudiotagger.audio.mp4.atom.Mp4BoxHeader header, ByteBuffer raw)
Construct binary field from rawdata of audio file

param
header
param
raw
throws
java.io.UnsupportedEncodingException

        super(header.getId());
        dataSize = header.getDataLength();
        build(raw);
    
Methods Summary
protected voidbuild(java.nio.ByteBuffer raw)
Build from data

After returning buffers position will be after the end of this atom

param
raw

        //Read the raw data into byte array
        this.dataBytes = new byte[dataSize];
        for (int i = 0; i < dataBytes.length; i++)
        {
            this.dataBytes[i] = raw.get();
        }
    
public voidcopyContent(org.jaudiotagger.tag.TagField field)

        throw new UnsupportedOperationException("not done");
    
public byte[]getData()

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

return
throws
java.io.UnsupportedEncodingException

        return dataBytes;
    
public intgetDataSize()

        return dataSize;

    
public Mp4FieldTypegetFieldType()

        return Mp4FieldType.IMPLICIT;
    
public byte[]getRawContent()

        logger.fine("Getting Raw data for:" + getId());
        try
        {
            ByteArrayOutputStream outerbaos = new ByteArrayOutputStream();
            outerbaos.write(Utils.getSizeBEInt32(Mp4BoxHeader.HEADER_LENGTH + dataSize));
            outerbaos.write(Utils.getDefaultBytes(getId(), "ISO-8859-1"));
            outerbaos.write(dataBytes);
            System.out.println("SIZE" + outerbaos.size());
            return outerbaos.toByteArray();
        }
        catch (IOException ioe)
        {
            //This should never happen as were not actually writing to/from a file
            throw new RuntimeException(ioe);
        }
    
public booleanisBinary()

        return true;
    
public booleanisEmpty()

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

        this.dataBytes = d;