public final class AsfTag extends AbstractTag
Modifier and Type | Field and Description |
---|---|
static Set<AsfFieldKey> |
COMMON_FIELDS
Stores a list of field keys, which identify common fields.
|
commonNumber, fields
Constructor and Description |
---|
AsfTag()
Creates an empty instance.
|
AsfTag(boolean copy)
Creates an instance and sets the field conversion property.
|
AsfTag(Tag source,
boolean copy)
Creates an instance and copies the fields of the source into the own
structure.
|
Modifier and Type | Method and Description |
---|---|
void |
addCopyright(String copyRight)
Creates a field for copyright and adds it.
|
void |
addField(TagField field)
Add field
|
void |
addRating(String rating)
Creates a field for rating and adds it.
|
AsfTagCoverField |
createArtworkField(byte[] data)
Create artwork field
|
TagField |
createCompilationField(boolean value)
Creates isCompilation field
It is useful to have this method because it handles ensuring that the correct value to represent a boolean
is stored in the underlying field format.
|
AsfTagTextField |
createCopyrightField(String content)
Creates a field for storing the copyright.
|
AsfTagCoverField |
createField(Artwork artwork)
Creates an
AsfTagCoverField from given artwork |
AsfTagTextField |
createField(AsfFieldKey asfFieldKey,
String value)
Create tag text field using ASF key
Uses the correct subclass for the key.
|
AsfTagTextField |
createField(FieldKey genericKey,
String... values)
Create a new field based on generic key, used internally by the library
|
AsfTagTextField |
createRatingField(String content)
Creates a field for storing the copyright.
|
void |
deleteField(AsfFieldKey fieldKey)
Removes all fields which are stored to the provided field key.
|
void |
deleteField(FieldKey fieldKey)
Delete any fields with this key
|
List<String> |
getAll(FieldKey genericKey)
Maps the generic key to the ogg key and return the list of values for this field as strings
|
List<Artwork> |
getArtworkList() |
Iterator<AsfTagField> |
getAsfFields()
This method iterates through all stored fields.
This method can only be used if this class has been created with field conversion turned on. |
List<TagField> |
getCopyright()
Returns a list of stored copyrights.
|
List<TagField> |
getFields(FieldKey fieldKey)
|
String |
getFirst(AsfFieldKey asfKey)
Retrieve the first value that exists for this asfkey
|
String |
getFirst(FieldKey genericKey)
Retrieve the first value that exists for this generic key
|
String |
getFirstCopyright()
Returns the Copyright.
|
AsfTagField |
getFirstField(FieldKey genericKey) |
String |
getFirstRating()
Returns the Rating.
|
List<TagField> |
getRating()
Returns a list of stored ratings.
|
String |
getValue(FieldKey genericKey,
int index)
Retrieve String value of the nth tag field that exists for this generic key
|
boolean |
hasField(AsfFieldKey asfFieldKey) |
boolean |
hasField(FieldKey genericKey)
Determines whether the tag has at least one field with the specified field key.
|
protected boolean |
isAllowedEncoding(Charset enc)
Determines whether the given charset encoding may be used for the
represented tagging system.
|
boolean |
isCopyingFields()
If
true , the copyFrom(TagField) method creates a
new AsfTagField instance and copies the content from the source.This method is utilized by addField(TagField) and
setField(TagField) .So if true it is ensured that the AsfTag instance
has its own copies of fields, which cannot be modified after assignment
(which could pass some checks), and it just stores AsfTagField
objects.Only then getAsfFields() can work. |
void |
setCopyright(String Copyright)
Sets the copyright.
|
void |
setField(TagField field)
Set field
Changed:Just because field is empty it doesn't mean it should be deleted.
|
void |
setRating(String rating)
Sets the Rating.
|
addField, addField, deleteArtworkField, deleteField, getAll, getAll, getFieldCount, getFieldCountIncludingSubValues, getFields, getFields, getFirst, getFirstArtwork, getFirstField, getItem, hasCommonFields, hasField, isEmpty, setEncoding, setField, setField, toString
public static final Set<AsfFieldKey> COMMON_FIELDS
public AsfTag()
public AsfTag(boolean copy)
copy
- look at isCopyingFields()
.public AsfTag(Tag source, boolean copy) throws UnsupportedEncodingException
source
- source to read tag fields from.copy
- look at isCopyingFields()
.UnsupportedEncodingException
- TagField.getRawContent()
which may be calledpublic void addField(TagField field)
addField
in interface Tag
addField
in class AbstractTag
field
- The field to add.Changed so add empty fields
public void addCopyright(String copyRight)
copyRight
- copyright contentpublic void addRating(String rating)
rating
- rating.public AsfTagCoverField createField(Artwork artwork)
AsfTagCoverField
from given artworkartwork
- artwork to create a ASF field from.public AsfTagCoverField createArtworkField(byte[] data)
data
- raw image datapublic AsfTagTextField createCopyrightField(String content)
content
- Copyright value.AsfTagTextField
public AsfTagTextField createRatingField(String content)
content
- Rating value.AsfTagTextField
public AsfTagTextField createField(AsfFieldKey asfFieldKey, String value)
asfFieldKey
- field key to create field for.value
- string value for the created field.public AsfTagTextField createField(FieldKey genericKey, String... values) throws KeyNotFoundException, FieldDataInvalidException
Only textual data supported at the moment. The genericKey will be mapped to the correct implementation key and return a TagField. Usually the value field should only be one value, but certain fields may require more than one value currently the only field to require this is the MUSICIAN field, it should contain instrument and then performer name
createField
in interface Tag
createField
in class AbstractTag
genericKey
- is the generic keyvalues
- to storeKeyNotFoundException
FieldDataInvalidException
public void deleteField(AsfFieldKey fieldKey)
fieldKey
- fields to remove.public void deleteField(FieldKey fieldKey) throws KeyNotFoundException
deleteField
in interface Tag
deleteField
in class AbstractTag
KeyNotFoundException
public List<TagField> getFields(FieldKey fieldKey) throws KeyNotFoundException
fieldKey
- The field id.TagField
objects with the given "id".KeyNotFoundException
public List<String> getAll(FieldKey genericKey) throws KeyNotFoundException
genericKey
- KeyNotFoundException
public Iterator<AsfTagField> getAsfFields()
public List<TagField> getCopyright()
public String getFirst(FieldKey genericKey) throws KeyNotFoundException
getFirst
in interface Tag
getFirst
in class AbstractTag
KeyNotFoundException
public String getFirst(AsfFieldKey asfKey) throws KeyNotFoundException
asfKey
- KeyNotFoundException
public String getValue(FieldKey genericKey, int index) throws KeyNotFoundException
KeyNotFoundException
public String getFirstCopyright()
public AsfTagField getFirstField(FieldKey genericKey) throws KeyNotFoundException
getFirstField
in interface Tag
getFirstField
in class AbstractTag
KeyNotFoundException
public String getFirstRating()
public List<TagField> getRating()
protected boolean isAllowedEncoding(Charset enc)
isAllowedEncoding
in class AbstractTag
enc
- true
if the given encoding can be used.public boolean isCopyingFields()
true
, the copyFrom(TagField)
method creates a
new AsfTagField
instance and copies the content from the source.addField(TagField)
and
setField(TagField)
.true
it is ensured that the AsfTag
instance
has its own copies of fields, which cannot be modified after assignment
(which could pass some checks), and it just stores AsfTagField
objects.getAsfFields()
can work. otherwise
IllegalStateException
is thrown.public void setField(TagField field)
setField
in interface Tag
setField
in class AbstractTag
field
- The field to add.Tag.setField(org.jaudiotagger.tag.TagField)
public void setCopyright(String Copyright)
Copyright
- the copyright to set.public void setRating(String rating)
rating
- the rating to set.public boolean hasField(FieldKey genericKey)
Tag
hasField
in interface Tag
hasField
in class AbstractTag
genericKey
- public boolean hasField(AsfFieldKey asfFieldKey)
asfFieldKey
- public TagField createCompilationField(boolean value) throws KeyNotFoundException, FieldDataInvalidException
Tag
KeyNotFoundException
FieldDataInvalidException
Copyright © 2005–2020 jthink.net. All rights reserved.