FrameBodyPICpublic class FrameBodyPIC extends AbstractID3v2FrameBody implements ID3v22FrameBodyID3v22 Attached Picture
This frame contains a picture directly related to the audio file.
Image format is preferably "PNG" [PNG] or "JPG" [JFIF]. 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 "PIC" frame, but only one with the same
ontent descriptor. There may only be one picture with the picture
type declared as picture type $01 and $02 respectively. There is a
possibility to put only a link to the image file by using the 'image
format' "-->" and having a complete URL [URL] instead of picture data.
The use of linked files should however be used restrictively since
there is the risk of separation of files.
Attached picture "PIC"
Frame size $xx xx xx
Text encoding $xx
Image format $xx xx xx
Picture type $xx
Description $00 (00)
Picture 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 |
Fields Summary |
---|
public static final String | IMAGE_IS_URL |
Constructors Summary |
---|
public FrameBodyPIC()Creates a new FrameBodyPIC datatype.
setObjectValue(DataTypes.OBJ_TEXT_ENCODING, TextEncoding.ISO_8859_1);
| public FrameBodyPIC(FrameBodyPIC body)
super(body);
| public FrameBodyPIC(byte textEncoding, String imageFormat, byte pictureType, String description, byte[] data)Creates a new FrameBodyPIC datatype.
this.setObjectValue(DataTypes.OBJ_TEXT_ENCODING, textEncoding);
this.setObjectValue(DataTypes.OBJ_IMAGE_FORMAT, imageFormat);
this.setPictureType(pictureType);
this.setDescription(description);
this.setImageData(data);
| public FrameBodyPIC(FrameBodyAPIC body)Conversion from v2 PIC to v3/v4 APIC
this.setObjectValue(DataTypes.OBJ_TEXT_ENCODING, body.getTextEncoding());
this.setObjectValue(DataTypes.OBJ_IMAGE_FORMAT, ImageFormats.getFormatForMimeType((String) body.getObjectValue(DataTypes.OBJ_MIME_TYPE)));
this.setObjectValue(DataTypes.OBJ_PICTURE_DATA, body.getObjectValue(DataTypes.OBJ_PICTURE_DATA));
this.setDescription(body.getDescription());
this.setImageData(body.getImageData());
| public FrameBodyPIC(ByteBuffer byteBuffer, int frameSize)Creates a new FrameBodyPIC datatype.
super(byteBuffer, frameSize);
|
Methods Summary |
---|
public java.lang.String | getDescription()Get a description of the image
return (String) getObjectValue(DataTypes.OBJ_DESCRIPTION);
| public java.lang.String | getFormatType()Get a description of the image
return (String) getObjectValue(DataTypes.OBJ_IMAGE_FORMAT);
| public java.lang.String | getIdentifier()The ID3v2 frame identifier
return ID3v22Frames.FRAME_ID_V2_ATTACHED_PICTURE;
| public byte[] | getImageData()Get Image data
return (byte[]) getObjectValue(DataTypes.OBJ_PICTURE_DATA);
| public java.lang.String | getImageUrl()
if (isImageUrl())
{
return Utils.getString(((byte[]) getObjectValue(DataTypes.OBJ_PICTURE_DATA)), 0, ((byte[]) getObjectValue(DataTypes.OBJ_PICTURE_DATA)).length, TextEncoding.CHARSET_ISO_8859_1);
}
else
{
return "";
}
| public java.lang.String | getMimeType()Get mimetype
return (String) getObjectValue(DataTypes.OBJ_MIME_TYPE);
| public int | getPictureType()
return ((Long) getObjectValue(DataTypes.OBJ_PICTURE_TYPE)).intValue();
| public boolean | isImageUrl()
return getFormatType() != null && getFormatType().equals(IMAGE_IS_URL);
| public void | setDescription(java.lang.String description)Set a description of the image
setObjectValue(DataTypes.OBJ_DESCRIPTION, description);
| public void | setImageData(byte[] imageData)Set imageData
setObjectValue(DataTypes.OBJ_PICTURE_DATA, imageData);
| public void | setPictureType(byte pictureType)Set Picture Type
setObjectValue(DataTypes.OBJ_PICTURE_TYPE, pictureType);
| protected void | setupObjectList()
objectList.add(new NumberHashMap(DataTypes.OBJ_TEXT_ENCODING, this, TextEncoding.TEXT_ENCODING_FIELD_SIZE));
objectList.add(new StringFixedLength(DataTypes.OBJ_IMAGE_FORMAT, this, 3));
objectList.add(new NumberHashMap(DataTypes.OBJ_PICTURE_TYPE, this, PictureTypes.PICTURE_TYPE_FIELD_SIZE));
objectList.add(new StringNullTerminated(DataTypes.OBJ_DESCRIPTION, this));
objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_PICTURE_DATA, this));
| public void | write(java.io.ByteArrayOutputStream tagBuffer)If the description cannot be encoded using current encoder, change the encoder
if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded())
{
this.setTextEncoding(TextEncoding.UTF_16);
}
super.write(tagBuffer);
|
|