FileDocCategorySizeDatePackage
ByteArraySizeTerminated.javaAPI DocJaudiotagger 2.0.43522Wed Jun 08 12:05:40 BST 2011org.jaudiotagger.tag.datatype

ByteArraySizeTerminated

public class ByteArraySizeTerminated extends AbstractDataType
Represents a stream of bytes, continuing until the end of the buffer. Usually used for binary data or where we havent yet mapped the data to a better fitting type.

Fields Summary
Constructors Summary
public ByteArraySizeTerminated(String identifier, org.jaudiotagger.tag.id3.AbstractTagFrameBody frameBody)

        super(identifier, frameBody);
    
public ByteArraySizeTerminated(ByteArraySizeTerminated object)

        super(object);
    
Methods Summary
public booleanequals(java.lang.Object obj)

        return obj instanceof ByteArraySizeTerminated && super.equals(obj);

    
public intgetSize()
Return the size in byte of this datatype

return
the size in bytes

        int len = 0;

        if (value != null)
        {
            len = ((byte[]) value).length;
        }

        return len;
    
public voidreadByteArray(byte[] arr, int offset)

param
arr
param
offset
throws
NullPointerException
throws
IndexOutOfBoundsException

        if (arr == null)
        {
            throw new NullPointerException("Byte array is null");
        }

        if (offset < 0)
        {
            throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + arr.length);
        }

        //Empty Byte Array
        if (offset >= arr.length)
        {
            value = null;
            return;
        }

        int len = arr.length - offset;
        value = new byte[len];
        System.arraycopy(arr, offset, value, 0, len);
    
public java.lang.StringtoString()
Because this is usually binary data and could be very long we just return the number of bytes held

return
the number of bytes

        return getSize() + " bytes";
    
public byte[]writeByteArray()
Write contents to a byte array

return
a byte array that that contians the data that should be perisisted to file

        logger.config("Writing byte array" + this.getIdentifier());
        return (byte[]) value;