Methods Summary |
---|
public void | addCopyright(java.lang.String copyRight)Creates a field for copyright and adds it.
addField(createCopyrightField(copyRight));
|
public void | addField(TagField field){@inheritDoc}
if (isValidField(field))
{
if (AsfFieldKey.isMultiValued(field.getId()))
{
super.addField(copyFrom(field));
}
else
{
super.setField(copyFrom(field));
}
}
|
public void | addRating(java.lang.String rating)Creates a field for rating and adds it.
addField(createRatingField(rating));
|
private void | copyFrom(Tag source)This method copies tag fields from the source.
final Iterator<TagField> fieldIterator = source.getFields();
// iterate over all fields
while (fieldIterator.hasNext())
{
final TagField copy = copyFrom(fieldIterator.next());
if (copy != null)
{
super.addField(copy);
}
}
|
private TagField | copyFrom(TagField source)If {@link #isCopyingFields()} is true , Creates a copy of
source , if its not empty-
However, plain {@link TagField} objects can only be transformed into
binary fields using their {@link TagField#getRawContent()} method.
TagField result;
if (isCopyingFields())
{
if (source instanceof AsfTagField)
{
try
{
result = (TagField) ((AsfTagField) source).clone();
}
catch (CloneNotSupportedException e)
{
result = new AsfTagField(((AsfTagField) source).getDescriptor());
}
}
else if (source instanceof TagTextField)
{
final String content = ((TagTextField) source).getContent();
result = new AsfTagTextField(source.getId(), content);
}
else
{
throw new RuntimeException("Unknown Asf Tag Field class:" // NOPMD
// by
// Christian
// Laireiter
// on
// 5/9/09
// 5:44
// PM
+ source.getClass());
}
}
else
{
result = source;
}
return result;
|
public AsfTagCoverField | createArtworkField(byte[] data)Create artwork field
return new AsfTagCoverField(data, PictureTypes.DEFAULT_ID, null, null);
|
public AsfTagTextField | createCopyrightField(java.lang.String content)Creates a field for storing the copyright.
return new AsfTagTextField(AsfFieldKey.COPYRIGHT, content);
|
public AsfTagTextField | createField(AsfFieldKey asfFieldKey, java.lang.String value)Create tag text field using ASF key
Uses the correct subclass for the key.
if (value == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
if (asfFieldKey == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
switch (asfFieldKey)
{
case COVER_ART:
throw new UnsupportedOperationException("Cover Art cannot be created using this method");
case BANNER_IMAGE:
throw new UnsupportedOperationException("Banner Image cannot be created using this method");
default:
return new AsfTagTextField(asfFieldKey.getFieldName(), value);
}
|
public AsfTagTextField | createField(FieldKey genericKey, java.lang.String value){@inheritDoc}
if (value == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
if (genericKey == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
final AsfFieldKey asfFieldKey = tagFieldToAsfField.get(genericKey);
if (asfFieldKey == null)
{
throw new KeyNotFoundException("No ASF fieldkey for " + genericKey.toString());
}
return createField(asfFieldKey, value);
|
public AsfTagCoverField | createField(org.jaudiotagger.tag.images.Artwork artwork)Creates an {@link AsfTagCoverField} from given artwork
return new AsfTagCoverField(artwork.getBinaryData(), artwork.getPictureType(), artwork.getDescription(), artwork.getMimeType());
|
public AsfTagTextField | createRatingField(java.lang.String content)Creates a field for storing the copyright.
return new AsfTagTextField(AsfFieldKey.RATING, content);
|
public void | deleteField(AsfFieldKey fieldKey)Removes all fields which are stored to the provided field key.
super.deleteField(fieldKey.getFieldName());
|
public void | deleteField(FieldKey fieldKey){@inheritDoc}
if (fieldKey == null)
{
throw new KeyNotFoundException();
}
super.deleteField(tagFieldToAsfField.get(fieldKey).getFieldName());
|
public java.util.List | getArtworkList()
final List<TagField> coverartList = getFields(FieldKey.COVER_ART);
final List<Artwork> artworkList = new ArrayList<Artwork>(coverartList.size());
for (final TagField next : coverartList)
{
final AsfTagCoverField coverArt = (AsfTagCoverField) next;
final Artwork artwork = ArtworkFactory.getNew();
artwork.setBinaryData(coverArt.getRawImageData());
artwork.setMimeType(coverArt.getMimeType());
artwork.setDescription(coverArt.getDescription());
artwork.setPictureType(coverArt.getPictureType());
artworkList.add(artwork);
}
return artworkList;
|
public java.util.Iterator | 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.
if (!isCopyingFields())
{
throw new IllegalStateException("Since the field conversion is not enabled, this method cannot be executed");
}
return new AsfFieldIterator(getFields());
|
public java.util.List | getCopyright()Returns a list of stored copyrights.
return getFields(AsfFieldKey.COPYRIGHT.getFieldName());
|
public java.util.List | getFields(FieldKey fieldKey){@inheritDoc}
if (fieldKey == null)
{
throw new KeyNotFoundException();
}
return super.getFields(tagFieldToAsfField.get(fieldKey).getFieldName());
|
public java.lang.String | getFirst(FieldKey genericKey){@inheritDoc}
return getValue(genericKey, 0);
|
public java.lang.String | getFirst(AsfFieldKey asfKey)Retrieve the first value that exists for this asfkey
if (asfKey == null)
{
throw new KeyNotFoundException();
}
return super.getFirst(asfKey.getFieldName());
|
public java.lang.String | getFirstCopyright()Returns the Copyright.
return getFirst(AsfFieldKey.COPYRIGHT.getFieldName());
|
public AsfTagField | getFirstField(FieldKey genericKey){@inheritDoc}
if (genericKey == null)
{
throw new KeyNotFoundException();
}
return (AsfTagField) super.getFirstField(tagFieldToAsfField.get(genericKey).getFieldName());
|
public java.lang.String | getFirstRating()Returns the Rating.
return getFirst(AsfFieldKey.RATING.getFieldName());
|
public java.util.List | getRating()Returns a list of stored ratings.
return getFields(AsfFieldKey.RATING.getFieldName());
|
public java.lang.String | getValue(FieldKey genericKey, int index){@inheritDoc}
if (genericKey == null)
{
throw new KeyNotFoundException();
}
return super.getItem(tagFieldToAsfField.get(genericKey).getFieldName(), index);
|
public boolean | hasField(FieldKey genericKey)
AsfFieldKey mp4FieldKey = tagFieldToAsfField.get(genericKey);
return getFields(mp4FieldKey.getFieldName()).size() != 0;
|
public boolean | hasField(AsfFieldKey asfFieldKey)
return getFields(asfFieldKey.getFieldName()).size() != 0;
|
protected boolean | isAllowedEncoding(java.lang.String enc){@inheritDoc}
return AsfHeader.ASF_CHARSET.name().equals(enc);
|
public boolean | isCopyingFields()If true , the {@link #copyFrom(TagField)} method creates a
new {@link AsfTagField} instance and copies the content from the source.
This method is utilized by {@link #addField(TagField)} and
{@link #setField(TagField)}.
So if true it is ensured that the {@link AsfTag} instance
has its own copies of fields, which cannot be modified after assignment
(which could pass some checks), and it just stores {@link AsfTagField}
objects.
Only then {@link #getAsfFields()} can work. otherwise
{@link IllegalStateException} is thrown.
return this.copyFields;
|
private boolean | isValidField(TagField field)Check field is valid and can be added to this tag
if (field == null)
{
return false;
}
if (!(field instanceof AsfTagField))
{
return false;
}
return !field.isEmpty();
|
public void | setCopyright(java.lang.String Copyright)Sets the copyright.
setField(createCopyrightField(Copyright));
|
public void | setField(TagField field){@inheritDoc}
if (isValidField(field))
{
// Copy only occurs if flag setField
super.setField(copyFrom(field));
}
|
public void | setRating(java.lang.String rating)Sets the Rating.
setField(createRatingField(rating));
|