|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jaudiotagger.audio.generic.AbstractTag
public abstract class AbstractTag
This class is the default implementation for
Tag and introduces some more useful
functionality to be implemented.
| Field Summary | |
|---|---|
protected int |
commonNumber
Stores the amount of TagField with TagField.isCommon()
true. |
protected java.util.Map<java.lang.String,java.util.List<TagField>> |
fields
This map stores the ids of the stored fields to the fields themselves. |
| Constructor Summary | |
|---|---|
AbstractTag()
|
|
| Method Summary | |
|---|---|
void |
addField(Artwork artwork)
Create field and then add within tag itself |
void |
addField(FieldKey genericKey,
java.lang.String value)
Create new field and add it to the tag |
void |
addField(TagField field)
Add field |
abstract TagField |
createField(FieldKey genericKey,
java.lang.String value)
Create a new field based on generic key, used internally by the library |
void |
deleteArtworkField()
Delete all instance of artwork Field |
abstract void |
deleteField(FieldKey fieldKey)
Delete any fields with this key |
void |
deleteField(java.lang.String key)
Delete all occurrences of field with this id. |
int |
getFieldCount()
Return field count TODO:There must be a more efficient way to do this. |
int |
getFieldCountIncludingSubValues()
Return the number of fields taking multiple value fields into consideration Fields that actually contain multiple values are counted seperately i.e. |
java.util.Iterator<TagField> |
getFields()
Iterator over all the fields within the tag, handle multiple fields with the same id |
java.util.List<TagField> |
getFields(FieldKey id)
Returns a list of TagField objects whose "id"
is the specified one. |
java.util.List<TagField> |
getFields(java.lang.String id)
Get list of fields within this tag with the specified id |
java.lang.String |
getFirst(FieldKey genericKey)
Retrieve the first value that exists for this generic key |
java.lang.String |
getFirst(java.lang.String id)
Retrieve String value of the first value that exists for this format specific key |
Artwork |
getFirstArtwork()
|
abstract TagField |
getFirstField(FieldKey genericKey)
|
TagField |
getFirstField(java.lang.String id)
Retrieve the first field that exists for this format specific key |
java.lang.String |
getItem(java.lang.String id,
int index)
|
java.lang.String |
getSubValue(FieldKey id,
int n,
int m)
The m parameter is effectively ignored |
boolean |
hasCommonFields()
Does this tag contain any comon fields |
boolean |
hasField(java.lang.String id)
Does this tag contain a field with the specified id |
protected abstract boolean |
isAllowedEncoding(java.lang.String enc)
Determines whether the given charset encoding may be used for the represented tagging system. |
boolean |
isEmpty()
Is this tag empty |
boolean |
setEncoding(java.lang.String enc)
Set or add encoding |
void |
setField(Artwork artwork)
Create field and then set within tag itself |
void |
setField(FieldKey genericKey,
java.lang.String value)
Create new field and set it in the tag |
void |
setField(TagField field)
Set field Changed:Just because field is empty it doesn't mean it should be deleted. |
java.lang.String |
toString()
(overridden) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jaudiotagger.tag.Tag |
|---|
createField, getArtworkList, getValue |
| Field Detail |
|---|
protected int commonNumber
TagField with TagField.isCommon()
true.
protected java.util.Map<java.lang.String,java.util.List<TagField>> fields
| Constructor Detail |
|---|
public AbstractTag()
| Method Detail |
|---|
public void addField(TagField field)
addField in interface Tagfield - The field to add.
Changed so add empty fieldspublic java.util.List<TagField> getFields(java.lang.String id)
getFields in interface Tagid - The field id.
TagField objects with the given "id".Tag.getFields(java.lang.String)
public java.util.List<TagField> getFields(FieldKey id)
throws KeyNotFoundException
TagTagField objects whose "id"
is the specified one.
getFields in interface Tagid -
KeyNotFoundException
public java.lang.String getItem(java.lang.String id,
int index)
id - index -
public java.lang.String getFirst(FieldKey genericKey)
throws KeyNotFoundException
getFirst in interface TaggenericKey -
KeyNotFoundExceptionpublic java.lang.String getFirst(java.lang.String id)
TagCan be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
getFirst in interface Tagid -
public TagField getFirstField(java.lang.String id)
TagCan be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
getFirstField in interface Tagid - audio specific key
public java.util.Iterator<TagField> getFields()
Tag
getFields in interface TagTag.getFields()public int getFieldCount()
getFieldCount in interface Tagpublic int getFieldCountIncludingSubValues()
Tag
getFieldCountIncludingSubValues in interface Tagpublic boolean hasCommonFields()
hasCommonFields in interface Tagtrue if a common
field is present.Tag.hasCommonFields()public boolean hasField(java.lang.String id)
hasField in interface Tagid - The field id to look for.
true if tag contains a TagField with the
given id.Tag.hasField(java.lang.String)protected abstract boolean isAllowedEncoding(java.lang.String enc)
enc - charset encoding.
true if the given encoding can be used.public boolean isEmpty()
isEmpty in interface Tagtrue if tag contains no field.Tag.isEmpty()
public void setField(FieldKey genericKey,
java.lang.String value)
throws KeyNotFoundException,
FieldDataInvalidException
setField in interface TaggenericKey - value -
KeyNotFoundException
FieldDataInvalidException
public void addField(FieldKey genericKey,
java.lang.String value)
throws KeyNotFoundException,
FieldDataInvalidException
addField in interface TaggenericKey - value -
KeyNotFoundException
FieldDataInvalidExceptionpublic void setField(TagField field)
setField in interface Tagfield - The field to add.Tag.setField(org.jaudiotagger.tag.TagField)
public java.lang.String getSubValue(FieldKey id,
int n,
int m)
getSubValue in interface Tagid - n - m -
public boolean setEncoding(java.lang.String enc)
setEncoding in interface TagTag.setEncoding(java.lang.String)public java.lang.String toString()
toString in interface TagtoString in class java.lang.ObjectObject.toString()
public abstract TagField createField(FieldKey genericKey,
java.lang.String value)
throws KeyNotFoundException,
FieldDataInvalidException
TagOnly textual data supported at the moment. The genericKey will be mapped to the correct implementation key and return a TagField.
createField in interface TaggenericKey - value -
KeyNotFoundException
FieldDataInvalidException
public abstract TagField getFirstField(FieldKey genericKey)
throws KeyNotFoundException
getFirstField in interface TaggenericKey -
KeyNotFoundException
public abstract void deleteField(FieldKey fieldKey)
throws KeyNotFoundException
Tag
deleteField in interface TagfieldKey -
KeyNotFoundExceptionpublic void deleteField(java.lang.String key)
deleteField in interface Tagkey - public Artwork getFirstArtwork()
getFirstArtwork in interface Tag
public void setField(Artwork artwork)
throws FieldDataInvalidException
setField in interface Tagartwork -
FieldDataInvalidException
public void addField(Artwork artwork)
throws FieldDataInvalidException
addField in interface Tagartwork -
FieldDataInvalidException
public void deleteArtworkField()
throws KeyNotFoundException
deleteArtworkField in interface TagKeyNotFoundException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||