Methods Summary |
---|
public void | addImage(org.jaudiotagger.tag.datatype.Lyrics3Image image)
images.add(image);
|
public boolean | equals(java.lang.Object obj)
if (!(obj instanceof FieldFrameBodyIMG))
{
return false;
}
FieldFrameBodyIMG object = (FieldFrameBodyIMG) obj;
return this.images.equals(object.images) && super.equals(obj);
|
public java.lang.String | getIdentifier()
return "IMG";
|
public int | getSize()
int size = 0;
Lyrics3Image image;
for (Object image1 : images)
{
image = (Lyrics3Image) image1;
size += (image.getSize() + 2); // addField CRLF pair
}
return size - 2; // cut off trailing crlf pair
|
public java.lang.String | getValue()
return writeString();
|
public boolean | isSubsetOf(java.lang.Object obj)
if (!(obj instanceof FieldFrameBodyIMG))
{
return false;
}
ArrayList<Lyrics3Image> superset = ((FieldFrameBodyIMG) obj).images;
for (Object image : images)
{
if (!superset.contains(image))
{
return false;
}
}
return super.isSubsetOf(obj);
|
public java.util.Iterator | iterator()
return images.iterator();
|
public void | read(java.nio.ByteBuffer byteBuffer)
String imageString;
byte[] buffer = new byte[5];
// read the 5 character size
byteBuffer.get(buffer, 0, 5);
int size = Integer.parseInt(new String(buffer, 0, 5));
if ((size == 0) && (!TagOptionSingleton.getInstance().isLyrics3KeepEmptyFieldIfRead()))
{
throw new InvalidTagException("Lyircs3v2 Field has size of zero.");
}
buffer = new byte[size];
// read the SIZE length description
byteBuffer.get(buffer);
imageString = new String(buffer);
readString(imageString);
|
private void | readString(java.lang.String imageString)
// now read each picture and put in the vector;
Lyrics3Image image;
String token;
int offset = 0;
int delim = imageString.indexOf(Lyrics3v2Fields.CRLF);
images = new ArrayList<Lyrics3Image>();
while (delim >= 0)
{
token = imageString.substring(offset, delim);
image = new Lyrics3Image("Image", this);
image.setFilename(token);
images.add(image);
offset = delim + Lyrics3v2Fields.CRLF.length();
delim = imageString.indexOf(Lyrics3v2Fields.CRLF, offset);
}
if (offset < imageString.length())
{
token = imageString.substring(offset);
image = new Lyrics3Image("Image", this);
image.setFilename(token);
images.add(image);
}
|
public void | setValue(java.lang.String value)
readString(value);
|
protected void | setupObjectList()TODO
|
public java.lang.String | toString()
String str = getIdentifier() + " : ";
for (Object image : images)
{
str += (image.toString() + " ; ");
}
return str;
|
public void | write(java.io.RandomAccessFile file)
int size;
int offset = 0;
byte[] buffer = new byte[5];
String str;
size = getSize();
str = Integer.toString(size);
for (int i = 0; i < (5 - str.length()); i++)
{
buffer[i] = (byte) '0";
}
offset += (5 - str.length());
for (int i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
offset += str.length();
file.write(buffer, 0, 5);
if (size > 0)
{
str = writeString();
buffer = new byte[str.length()];
for (int i = 0; i < str.length(); i++)
{
buffer[i] = (byte) str.charAt(i);
}
file.write(buffer);
}
|
private java.lang.String | writeString()
String str = "";
Lyrics3Image image;
for (Object image1 : images)
{
image = (Lyrics3Image) image1;
str += (image.writeString() + Lyrics3v2Fields.CRLF);
}
if (str.length() > 2)
{
return str.substring(0, str.length() - 2);
}
return str;
|