public boolean equals(Object obj) { return obj instanceof MultipleTextEncodedStringNullTerminated && super.equals(obj); }
/** * Set size based on size of the DataTypes making up the body,done after write */ public void setSize() { size = 0; for (AbstractDataType object : objectList) { size += object.getSize(); } }
public List<T> getValue() { return (List<T>)super.getValue(); }
object.readByteArray(buffer, offset); offset += object.getSize();
data.readByteArray(buffer, currentOffset); data.setBody(frameBody); getValue().add(data); currentOffset+=data.getSize();
/** * Sets all objects of identifier type to value defined by <code>obj</code> argument. * * @param identifier <code>MP3Object</code> identifier * @param value new datatype value */ public final void setObjectValue(String identifier, Object value) { AbstractDataType object; Iterator<AbstractDataType> iterator = objectList.listIterator(); while (iterator.hasNext()) { object = iterator.next(); if (object.getIdentifier().equals(identifier)) { object.setValue(value); } } }
/** * This method calls <code>toString</code> for all it's objects and appends * them without any newline characters. * * @return brief description string */ public String getBriefDescription() { String str = ""; for (AbstractDataType object : objectList) { if ((object.toString() != null) && (object.toString().length() > 0)) { str += (object.getIdentifier() + "=\"" + object.toString() + "\"; "); } } return str; }
/** * Construct an abstract datatype identified by identifier and linked to a framebody initilised with a value * * @param identifier to allow retrieval of this datatype by name from framebody * @param frameBody that the dataype is associated with * @param value of this DataType */ protected AbstractDataType(String identifier, AbstractTagFrameBody frameBody, Object value) { this.identifier = identifier; this.frameBody = frameBody; setValue(value); }
/** * Write the contents of this datatype to the file at the position it is * currently at. * * @param file destination file * @throws IOException on any I/O error */ public void write(RandomAccessFile file) throws IOException { //Write the various fields to file in order byte[] buffer; AbstractDataType object; Iterator<AbstractDataType> iterator = objectList.listIterator(); while (iterator.hasNext()) { object = iterator.next(); buffer = object.writeByteArray(); file.write(buffer); } }
/** * Copy Constructor for fragment body. Copies all objects in the * Object Iterator with data. * * @param copyObject */ protected AbstractTagFrameBody(AbstractTagFrameBody copyObject) { AbstractDataType newObject; for (int i = 0; i < copyObject.objectList.size(); i++) { newObject = (AbstractDataType) ID3Tags.copyObject(copyObject.objectList.get(i)); newObject.setBody(this); this.objectList.add(newObject); } }
/** * Simplified wrapper for reading bytes from file into Object. * Used for reading Strings, this class should be overridden * for non String Objects * * @param arr * @throws org.jaudiotagger.tag.InvalidDataTypeException */ final public void readByteArray(byte[] arr) throws InvalidDataTypeException { readByteArray(arr, 0); }
/** * Return String Representation of Datatype * */ public void createStructure() { MP3File.getStructureFormatter().openHeadingElement(TYPE_BODY, ""); for (AbstractDataType nextObject : objectList) { nextObject.createStructure(); } MP3File.getStructureFormatter().closeHeadingElement(TYPE_BODY); } }
object.readByteArray(buffer, offset); offset += object.getSize();
/** * Sets all objects of identifier type to value defined by <code>obj</code> argument. * * @param identifier <code>MP3Object</code> identifier * @param value new datatype value */ public final void setObjectValue(String identifier, Object value) { AbstractDataType object; Iterator<AbstractDataType> iterator = objectList.listIterator(); while (iterator.hasNext()) { object = iterator.next(); if (object.getIdentifier().equals(identifier)) { object.setValue(value); } } }
/** * This method calls <code>toString</code> for all it's objects and appends * them. It contains new line characters and is more suited for display * purposes * * @return formatted description string */ public final String getLongDescription() { String str = ""; for (AbstractDataType object : objectList) { if ((object.toString() != null) && (object.toString().length() > 0)) { str += (object.getIdentifier() + " = " + object.toString() + "\n"); } } return str; }
/** * Construct an abstract datatype identified by identifier and linked to a framebody initilised with a value * * @param identifier to allow retrieval of this datatype by name from framebody * @param frameBody that the dataype is associated with * @param value of this DataType */ protected AbstractDataType(String identifier, AbstractTagFrameBody frameBody, Object value) { this.identifier = identifier; this.frameBody = frameBody; setValue(value); }
/** * Write the contents of this datatype to the file at the position it is * currently at. * * @param file destination file * @throws IOException on any I/O error */ public void write(RandomAccessFile file) throws IOException { //Write the various fields to file in order byte[] buffer; AbstractDataType object; Iterator<AbstractDataType> iterator = objectList.listIterator(); while (iterator.hasNext()) { object = iterator.next(); buffer = object.writeByteArray(); file.write(buffer); } }
/** * Copy Constructor for fragment body. Copies all objects in the * Object Iterator with data. * @param copyObject */ protected AbstractTagFrameBody(AbstractTagFrameBody copyObject) { AbstractDataType newObject; for (int i = 0; i < copyObject.objectList.size(); i++) { newObject = (AbstractDataType) ID3Tags.copyObject(copyObject.objectList.get(i)); newObject.setBody(this); this.objectList.add(newObject); } }
/** * Simplified wrapper for reading bytes from file into Object. * Used for reading Strings, this class should be overridden * for non String Objects * * @param arr * @throws org.jaudiotagger.tag.InvalidDataTypeException */ final public void readByteArray(byte[] arr) throws InvalidDataTypeException { readByteArray(arr, 0); }
/** * Return String Representation of Datatype * */ public void createStructure() { MP3File.getStructureFormatter().openHeadingElement(TYPE_BODY, ""); for (AbstractDataType nextObject : objectList) { nextObject.createStructure(); } MP3File.getStructureFormatter().closeHeadingElement(TYPE_BODY); } }