|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 |
protected void |
deleteField(java.lang.String key)
Delete all ocurrences of field. |
java.util.List<TagField> |
get(java.lang.String id)
Get list of fields within this tag with the specified id |
int |
getFieldCount()
Return field count TODO:There must be a more efficient way to do this. |
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. |
abstract java.lang.String |
getFirst(FieldKey genericKey)
Retrieve String value of the first tagfield 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 |
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 doesnt 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 |
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 Tag
field
- The field to add.
Changed so add empty fields
public java.util.List<TagField> get(java.lang.String id)
get
in interface Tag
id
- The field id.
TagField
objects with the given "id".Tag.get(java.lang.String)
public java.util.List<TagField> getFields(FieldKey id) throws KeyNotFoundException
Tag
TagField
objects whose "id"
is the specified one.
getFields
in interface Tag
id
-
KeyNotFoundException
public java.lang.String getFirst(java.lang.String id)
Tag
Can be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
getFirst
in interface Tag
id
-
public TagField getFirstField(java.lang.String id)
Tag
Can be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
getFirstField
in interface Tag
id
- audio specific key
public java.util.Iterator<TagField> getFields()
Tag
getFields
in interface Tag
Tag.getFields()
public int getFieldCount()
getFieldCount
in interface Tag
public boolean hasCommonFields()
hasCommonFields
in interface Tag
true
if a common
field is present.Tag.hasCommonFields()
public boolean hasField(java.lang.String id)
hasField
in interface Tag
id
- 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 Tag
true
if tag contains no field.Tag.isEmpty()
public void setField(FieldKey genericKey, java.lang.String value) throws KeyNotFoundException, FieldDataInvalidException
setField
in interface Tag
genericKey
- value
-
KeyNotFoundException
FieldDataInvalidException
public void addField(FieldKey genericKey, java.lang.String value) throws KeyNotFoundException, FieldDataInvalidException
addField
in interface Tag
genericKey
- value
-
KeyNotFoundException
FieldDataInvalidException
public void setField(TagField field)
setField
in interface Tag
field
- The field to add.Tag.setField(org.jaudiotagger.tag.TagField)
public boolean setEncoding(java.lang.String enc)
setEncoding
in interface Tag
Tag.setEncoding(java.lang.String)
public java.lang.String toString()
toString
in interface Tag
toString
in class java.lang.Object
Object.toString()
public abstract TagField createField(FieldKey genericKey, java.lang.String value) throws KeyNotFoundException, FieldDataInvalidException
Tag
Only textual data supported at the moment. The genericKey will be mapped to the correct implementation key and return a TagField.
It is not recommended to use this method for normal use of the audiolibrary, this is snot added to the structure
createField
in interface Tag
genericKey
- value
-
KeyNotFoundException
FieldDataInvalidException
public abstract java.lang.String getFirst(FieldKey genericKey) throws KeyNotFoundException
Tag
getFirst
in interface Tag
genericKey
-
KeyNotFoundException
public abstract TagField getFirstField(FieldKey genericKey) throws KeyNotFoundException
getFirstField
in interface Tag
genericKey
-
KeyNotFoundException
public abstract void deleteField(FieldKey fieldKey) throws KeyNotFoundException
Tag
deleteField
in interface Tag
fieldKey
-
KeyNotFoundException
protected void deleteField(java.lang.String key)
key
- public Artwork getFirstArtwork()
getFirstArtwork
in interface Tag
public void setField(Artwork artwork) throws FieldDataInvalidException
setField
in interface Tag
artwork
-
FieldDataInvalidException
public void addField(Artwork artwork) throws FieldDataInvalidException
addField
in interface Tag
artwork
-
FieldDataInvalidException
public void deleteArtworkField() throws KeyNotFoundException
deleteArtworkField
in interface Tag
KeyNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |