org.jaudiotagger.tag.id3.framebody
Class FrameBodyAPIC

java.lang.Object
  extended by org.jaudiotagger.tag.id3.AbstractTagItem
      extended by org.jaudiotagger.tag.id3.AbstractTagFrameBody
          extended by org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody
              extended by org.jaudiotagger.tag.id3.framebody.FrameBodyAPIC
All Implemented Interfaces:
ID3v23FrameBody, ID3v24FrameBody

public class FrameBodyAPIC
extends AbstractID3v2FrameBody
implements ID3v24FrameBody, ID3v23FrameBody

Attached picture frame.

This frame contains a picture directly related to the audio file. Image format is the MIME type and subtype for the image. In the event that the MIME media type name is omitted, "image/" will be implied. The "image/png" or "image/jpeg" picture format should be used when interoperability is wanted. Description is a short description of the picture, represented as a terminated textstring. The description has a maximum length of 64 characters, but may be empty. There may be several pictures attached to one file, each in their individual "APIC" frame, but only one with the same content descriptor. There may only be one picture with the picture type declared as picture type $01 and $02 respectively. There is the possibility to put only a link to the image file by using the 'MIME type' "-->" and having a complete URL instead of picture data. The use of linked files should however be used sparingly since there is the risk of separation of files.

<Header for 'Attached picture', ID: "APIC">
Text encoding $xx
MIME type <text string> $00
Picture type $xx
Description <text string according to encoding> $00 (00)
Picture data <binary data>

Picture type: $00 Other
$01 32x32 pixels 'file icon' (PNG only)
$02 Other file icon
$03 Cover (front)
$04 Cover (back)
$05 Leaflet page
$06 Media (e.g. lable side of CD)
$07 Lead artist/lead performer/soloist
$08 Artist/performer
$09 Conductor
$0A Band/Orchestra
$0B Composer
$0C Lyricist/text writer
$0D Recording Location
$0E During recording
$0F During performance
$10 Movie/video screen capture
$11 A bright coloured fish
$12 Illustration
$13 Band/artist logotype
$14 Publisher/Studio logotype

For more details, please refer to the ID3 specifications:

Version:
$Id: FrameBodyAPIC.java,v 1.23 2009/11/12 15:42:56 paultaylor Exp $
Author:
: Paul Taylor, : Eric Farng

Field Summary
static java.lang.String IMAGE_IS_URL
           
 
Fields inherited from class org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody
TYPE_BODY
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractTagFrameBody
objectList
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractTagItem
logger
 
Constructor Summary
FrameBodyAPIC()
          Creates a new FrameBodyAPIC datatype.
FrameBodyAPIC(java.nio.ByteBuffer byteBuffer, int frameSize)
          Creates a new FrameBodyAPIC datatype.
FrameBodyAPIC(byte textEncoding, java.lang.String mimeType, byte pictureType, java.lang.String description, byte[] data)
          Creates a new FrameBodyAPIC datatype.
FrameBodyAPIC(FrameBodyAPIC body)
           
FrameBodyAPIC(FrameBodyPIC body)
          Conversion from v2 PIC to v3/v4 APIC
 
Method Summary
 java.lang.String getDescription()
          Get a description of the image
 java.lang.String getIdentifier()
          The ID3v2 frame identifier
 byte[] getImageData()
          Get Image data
 java.lang.String getImageUrl()
           
 java.lang.String getMimeType()
          Get mimetype
 int getPictureType()
           
 boolean isImageUrl()
           
 void setDescription(java.lang.String description)
          Set a description of the image
 void setImageData(byte[] imageData)
          Set imageData
 void setMimeType(java.lang.String mimeType)
          Set mimeType
 void setPictureType(byte pictureType)
          Set Picture Type
protected  void setupObjectList()
          Create the list of Datatypes that this body expects in the correct order This method needs to be implemented by concrete subclasses
 void write(java.io.ByteArrayOutputStream tagBuffer)
          If the description cannot be encoded using current encoder, change the encoder
 
Methods inherited from class org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody
createStructure, equals, getSize, read, setSize, setSize
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractTagFrameBody
getBriefDescription, getHeader, getLongDescription, getObject, getObjectValue, getTextEncoding, isSubsetOf, iterator, setHeader, setObjectValue, setTextEncoding, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IMAGE_IS_URL

public static final java.lang.String IMAGE_IS_URL
See Also:
Constant Field Values
Constructor Detail

FrameBodyAPIC

public FrameBodyAPIC()
Creates a new FrameBodyAPIC datatype.


FrameBodyAPIC

public FrameBodyAPIC(FrameBodyAPIC body)

FrameBodyAPIC

public FrameBodyAPIC(FrameBodyPIC body)
Conversion from v2 PIC to v3/v4 APIC

Parameters:
body -

FrameBodyAPIC

public FrameBodyAPIC(byte textEncoding,
                     java.lang.String mimeType,
                     byte pictureType,
                     java.lang.String description,
                     byte[] data)
Creates a new FrameBodyAPIC datatype.

Parameters:
textEncoding -
mimeType -
pictureType -
description -
data -

FrameBodyAPIC

public FrameBodyAPIC(java.nio.ByteBuffer byteBuffer,
                     int frameSize)
              throws InvalidTagException
Creates a new FrameBodyAPIC datatype.

Parameters:
byteBuffer -
frameSize -
Throws:
InvalidTagException - if unable to create framebody from buffer
Method Detail

setDescription

public void setDescription(java.lang.String description)
Set a description of the image

Parameters:
description -

getDescription

public java.lang.String getDescription()
Get a description of the image

Returns:
a description of the image

setMimeType

public void setMimeType(java.lang.String mimeType)
Set mimeType

Parameters:
mimeType -

getMimeType

public java.lang.String getMimeType()
Get mimetype

Returns:
a description of the image

setImageData

public void setImageData(byte[] imageData)
Set imageData

Parameters:
imageData -

getImageData

public byte[] getImageData()
Get Image data

Returns:

setPictureType

public void setPictureType(byte pictureType)
Set Picture Type

Parameters:
pictureType -

getPictureType

public int getPictureType()
Returns:
picturetype

getIdentifier

public java.lang.String getIdentifier()
The ID3v2 frame identifier

Specified by:
getIdentifier in class AbstractID3v2FrameBody
Returns:
the ID3v2 frame identifier for this frame type

write

public void write(java.io.ByteArrayOutputStream tagBuffer)
If the description cannot be encoded using current encoder, change the encoder

Overrides:
write in class AbstractID3v2FrameBody

setupObjectList

protected void setupObjectList()
Description copied from class: AbstractTagFrameBody
Create the list of Datatypes that this body expects in the correct order This method needs to be implemented by concrete subclasses

Specified by:
setupObjectList in class AbstractTagFrameBody

isImageUrl

public boolean isImageUrl()
Returns:
true if imagedata is held as a url rather than actually being imagedata

getImageUrl

public java.lang.String getImageUrl()
Returns:
the image url if there is otherwise return an empty String