public static void setFieldExample(File srcFile, File dstFile, String artist)
throws Exception
{
// Since this is an example, I do no checking of parameters.
MusicMetadataSet src_set = new MyID3().read(srcFile);
IMusicMetadata metadataToWrite;
if (src_set != null)
{
// The source file DID have an ID3v1 or ID3v2 tag (or both).
// We'll update those values.
metadataToWrite = src_set.merged;
} else
{
// The file did not have an ID3v1 or ID3v2 tag, so
// we need to add new tag(s).
metadataToWrite = MusicMetadata.createEmptyMetadata();
}
// here we set or update the artist field.
metadataToWrite.setArtist(artist);
new MyID3().write(srcFile, dstFile, src_set, metadataToWrite);
}