|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.generic.AbstractTag org.jaudiotagger.audio.asf.tag.AsfTag
public final class AsfTag
Tag implementation for ASF.
Nested Class Summary | |
---|---|
private static class |
AsfTag.AsfFieldIterator
This iterator is used to iterator an Iterator with
TagField objects and returns them by casting to
AsfTagField . |
Field Summary | |
---|---|
static java.util.Set<AsfFieldKey> |
COMMON_FIELDS
Stores a list of field keys, which identify common fields. |
private boolean |
copyFields
|
private static java.util.EnumMap<FieldKey,AsfFieldKey> |
TAGFIELD_TO_ASFFIELD
This map contains the mapping from FieldKey to
AsfFieldKey . |
Fields inherited from class org.jaudiotagger.audio.generic.AbstractTag |
---|
commonNumber, fields |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
addCopyright(java.lang.String copyRight)
Creates a field for copyright and adds it. |
void |
addField(TagField field)
Add field |
void |
addRating(java.lang.String rating)
Creates a field for rating and adds it. |
private void |
copyFrom(Tag source)
This method copies tag fields from the source. |
private TagField |
copyFrom(TagField source)
If isCopyingFields() is true , Creates a copy of
source , if its not empty-However, plain TagField objects can only be transformed into
binary fields using their TagField.getRawContent() method. |
AsfTagCoverField |
createArtworkField(byte[] data)
Create artwork field |
AsfTagTextField |
createCopyrightField(java.lang.String content)
Creates a field for storing the copyright. |
AsfTagCoverField |
createField(Artwork artwork)
Creates an AsfTagCoverField from given artwork |
AsfTagTextField |
createField(FieldKey genericKey,
java.lang.String value)
Create a new field based on generic key, used internally by the library |
AsfTagTextField |
createRatingField(java.lang.String content)
Creates a field for storing the copyright. |
AsfTagTextField |
createTagField(AsfFieldKey asfFieldKey,
java.lang.String value)
Create tag text field using ASF key Uses the correct subclass for the key. |
void |
deleteField(FieldKey fieldKey)
Delete any fields with this key |
void |
deleteTagField(AsfFieldKey fieldKey)
Removes all fields which are stored to the provided field key. |
java.util.List<Artwork> |
getArtworkList()
|
java.util.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. |
java.util.List<TagField> |
getCopyright()
Returns a list of stored copyrights. |
java.util.List<TagField> |
getFields(FieldKey fieldKey)
Returns a list of TagField objects whose "id"
is the specified one. |
java.lang.String |
getFirst(FieldKey genericKey)
Retrieve String value of the first tagfield that exists for this generic key |
java.lang.String |
getFirstCopyright()
Returns the Copyright. |
AsfTagField |
getFirstField(FieldKey genericKey)
|
java.lang.String |
getFirstRating()
Returns the Rating. |
java.util.List<TagField> |
getRating()
Returns a list of stored ratings. |
protected boolean |
isAllowedEncoding(java.lang.String 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. |
private boolean |
isValidField(TagField field)
Check field is valid and can be added to this tag |
void |
setCopyright(java.lang.String Copyright)
Sets the copyright. |
void |
setField(TagField field)
Set field Changed:Just because field is empty it doesnt mean it should be deleted. |
void |
setRating(java.lang.String rating)
Sets the Rating. |
Methods inherited from class org.jaudiotagger.audio.generic.AbstractTag |
---|
addField, addField, deleteArtworkField, deleteField, get, getFieldCount, getFields, getFirst, getFirstArtwork, getFirstField, hasCommonFields, hasField, isEmpty, setEncoding, setField, setField, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.util.Set<AsfFieldKey> COMMON_FIELDS
private static final java.util.EnumMap<FieldKey,AsfFieldKey> TAGFIELD_TO_ASFFIELD
FieldKey
to
AsfFieldKey
.
private final boolean copyFields
isCopyingFields()
Constructor Detail |
---|
public AsfTag()
public AsfTag(boolean copy)
copy
- look at isCopyingFields()
.public AsfTag(Tag source, boolean copy) throws java.io.UnsupportedEncodingException
source
- source to read tag fields from.copy
- look at isCopyingFields()
.
java.io.UnsupportedEncodingException
- TagField.getRawContent()
which may be calledMethod Detail |
---|
public 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(java.lang.String copyRight)
copyRight
- copyright contentpublic void addRating(java.lang.String rating)
rating
- rating.private void copyFrom(Tag source)
source
- source to read tag fields from.private TagField copyFrom(TagField source)
isCopyingFields()
is true
, Creates a copy of
source
, if its not empty-TagField
objects can only be transformed into
binary fields using their TagField.getRawContent()
method.
source
- source field to copy.
null
if the field is empty (empty byte[] or blank
string}.public AsfTagCoverField createField(Artwork artwork)
AsfTagCoverField
from given artwork
artwork
- artwork to create a ASF field from.
public AsfTagCoverField createArtworkField(byte[] data)
data
- raw image data
public AsfTagTextField createCopyrightField(java.lang.String content)
content
- Copyright value.
AsfTagTextField
public AsfTagTextField createRatingField(java.lang.String content)
content
- Rating value.
AsfTagTextField
public AsfTagTextField createTagField(AsfFieldKey asfFieldKey, java.lang.String value)
asfFieldKey
- field key to create field for.value
- string value for the created field.
public AsfTagTextField createField(FieldKey genericKey, java.lang.String value) throws KeyNotFoundException, FieldDataInvalidException
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
createField
in class AbstractTag
genericKey
- is the generic keyvalue
- to store
KeyNotFoundException
FieldDataInvalidException
public void deleteTagField(AsfFieldKey fieldKey)
fieldKey
- fields to remove.public void deleteField(FieldKey fieldKey) throws KeyNotFoundException
deleteField
in interface Tag
deleteField
in class AbstractTag
KeyNotFoundException
public java.util.List<TagField> getFields(FieldKey fieldKey) throws KeyNotFoundException
TagField
objects whose "id"
is the specified one.
getFields
in interface Tag
getFields
in class AbstractTag
fieldKey
- The field id.
TagField
objects with the given "id".
KeyNotFoundException
public java.util.List<Artwork> getArtworkList()
public java.util.Iterator<AsfTagField> getAsfFields()
public java.util.List<TagField> getCopyright()
public java.lang.String getFirst(FieldKey genericKey) throws KeyNotFoundException
getFirst
in interface Tag
getFirst
in class AbstractTag
KeyNotFoundException
public java.lang.String getFirstCopyright()
public AsfTagField getFirstField(FieldKey genericKey) throws KeyNotFoundException
getFirstField
in interface Tag
getFirstField
in class AbstractTag
KeyNotFoundException
public java.lang.String getFirstRating()
public java.util.List<TagField> getRating()
protected boolean isAllowedEncoding(java.lang.String enc)
isAllowedEncoding
in class AbstractTag
enc
- charset encoding.
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.
private boolean isValidField(TagField field)
field
- field to add
true
if field may be added.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(java.lang.String Copyright)
Copyright
- the copyright to set.public void setRating(java.lang.String rating)
rating
- the rating to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |