public class MetadataBlockDataPicture extends java.lang.Object implements MetadataBlockData, TagField
This block is for storing pictures associated with the file, most commonly cover art from CDs. There may be more than one PICTURE block in a file. The picture format is similar to the APIC frame in ID3v2. The PICTURE block has a type, MIME type, and UTF-8 description like ID3v2, and supports external linking via URL (though this is discouraged). The differences are that there is no uniqueness constraint on the description field, and the MIME type is mandatory. The FLAC PICTURE block also includes the resolution, color depth, and palette size so that the client can search for a suitable picture without having to scan them all
Format:Modifier and Type | Field and Description |
---|---|
private int |
colourDepth |
private java.lang.String |
description |
private int |
height |
static java.lang.String |
IMAGE_IS_URL |
private byte[] |
imageData |
private int |
indexedColouredCount |
static java.util.logging.Logger |
logger |
private java.lang.String |
mimeType |
private int |
pictureType |
private int |
width |
Constructor and Description |
---|
MetadataBlockDataPicture(byte[] imageData,
int pictureType,
java.lang.String mimeType,
java.lang.String description,
int width,
int height,
int colourDepth,
int indexedColouredCount)
Construct new MetadataPicture block
|
MetadataBlockDataPicture(java.nio.ByteBuffer rawdata)
Initialize MetaBlockDataPicture from byteBuffer
|
MetadataBlockDataPicture(MetadataBlockHeader header,
java.io.RandomAccessFile raf)
Construct picture block by reading from file, the header informs us how many bytes we should be reading from
|
Modifier and Type | Method and Description |
---|---|
void |
copyContent(TagField field)
This method copies the data of the given field to the current data.
|
byte[] |
getBytes() |
int |
getColourDepth() |
java.lang.String |
getDescription() |
int |
getHeight() |
java.lang.String |
getId()
Returns the Id of the represented tag field.
This value should uniquely identify a kind of tag data, like title. |
byte[] |
getImageData() |
java.lang.String |
getImageUrl() |
int |
getIndexedColourCount() |
int |
getLength() |
java.lang.String |
getMimeType() |
int |
getPictureType() |
byte[] |
getRawContent()
This method delivers the binary representation of the fields data in
order to be directly written to the file.
|
private java.lang.String |
getString(java.nio.ByteBuffer rawdata,
int length,
java.lang.String charset) |
int |
getWidth() |
private void |
initFromByteBuffer(java.nio.ByteBuffer rawdata) |
boolean |
isBinary()
Determines whether the represented field contains (is made up of) binary
data, instead of text data.
Software can identify fields to be displayed because they are human readable if this method returns false . |
void |
isBinary(boolean b)
Deprecated.
As for now is of no use. Implementations should use another
way of setting this property.
|
boolean |
isCommon()
Identifies a field to be of common use.
Some software may differ between common and not common fields. |
boolean |
isEmpty()
Determines whether the content of the field is empty.
|
boolean |
isImageUrl() |
java.lang.String |
toString()
This method returns a human readable description of the fields contents.
For text fields it should be the text itself. |
public static final java.lang.String IMAGE_IS_URL
private int pictureType
private java.lang.String mimeType
private java.lang.String description
private int width
private int height
private int colourDepth
private int indexedColouredCount
private byte[] imageData
public static java.util.logging.Logger logger
public MetadataBlockDataPicture(java.nio.ByteBuffer rawdata) throws java.io.IOException, InvalidFrameException
rawdata
- java.io.IOException
InvalidFrameException
public MetadataBlockDataPicture(MetadataBlockHeader header, java.io.RandomAccessFile raf) throws java.io.IOException, InvalidFrameException
header
- raf
- java.io.IOException
InvalidFrameException
public MetadataBlockDataPicture(byte[] imageData, int pictureType, java.lang.String mimeType, java.lang.String description, int width, int height, int colourDepth, int indexedColouredCount)
imageData
- pictureType
- mimeType
- description
- width
- height
- colourDepth
- indexedColouredCount
- private void initFromByteBuffer(java.nio.ByteBuffer rawdata) throws java.io.IOException, InvalidFrameException
java.io.IOException
InvalidFrameException
private java.lang.String getString(java.nio.ByteBuffer rawdata, int length, java.lang.String charset) throws java.io.IOException
java.io.IOException
public byte[] getBytes()
getBytes
in interface MetadataBlockData
public int getLength()
getLength
in interface MetadataBlockData
public int getPictureType()
public java.lang.String getMimeType()
public java.lang.String getDescription()
public int getWidth()
public int getHeight()
public int getColourDepth()
public int getIndexedColourCount()
public byte[] getImageData()
public boolean isImageUrl()
public java.lang.String getImageUrl()
public java.lang.String toString()
TagField
public void copyContent(TagField field)
copyContent
in interface TagField
field
- The field containing the data to be taken.public java.lang.String getId()
AbstractTag
will use the "id" to summarize multiple
fields.public byte[] getRawContent() throws java.io.UnsupportedEncodingException
getRawContent
in interface TagField
java.io.UnsupportedEncodingException
- Most tag data represents text. In some cases the underlying
implementation will need to convert the text data in java to
a specific charset encoding. In these cases an
UnsupportedEncodingException
may occur.public boolean isBinary()
false
.public void isBinary(boolean b)
public boolean isCommon()
Copyright © 2005-2013 java.net. All Rights Reserved.