public final class ID3V2Tag extends ID3Tag
Represents an ID3v2 tag.
Please find more information at <a href="https://en.wikipedia.org/wiki/ID3#ID3v2">https://en.wikipedia.org/wiki/ID3#ID3v2</a>
.
Learn more
This example shows how to read the ID3v2 tag in an MP3 file.
try (Metadata metadata = new Metadata(Constants.MP3WithID3V2)) { MP3RootPackage root = metadata.getRootPackageGeneric(); if (root.getID3V2() != null) { System.out.println(root.getID3V2().getAlbum()); System.out.println(root.getID3V2().getArtist()); System.out.println(root.getID3V2().getBand()); System.out.println(root.getID3V2().getTitle()); System.out.println(root.getID3V2().getComposers()); System.out.println(root.getID3V2().getCopyright()); System.out.println(root.getID3V2().getPublisher()); System.out.println(root.getID3V2().getOriginalAlbum()); System.out.println(root.getID3V2().getMusicalKey()); if (root.getID3V2().getAttachedPictures() != null) { for (ID3V2AttachedPictureFrame attachedPicture : root.getID3V2().getAttachedPictures()) { System.out.println(attachedPicture.getAttachedPictureType()); System.out.println(attachedPicture.getMimeType()); System.out.println(attachedPicture.getDescription()); // ... } } // ... } }
Constructor and Description |
---|
ID3V2Tag()
Initializes a new instance of the
ID3V2Tag class. |
Modifier and Type | Method and Description |
---|---|
void |
add(ID3V2TagFrame frame)
Adds a frame to the tag.
|
void |
clear(String frameId)
Removes all frames with the specified id.
|
ID3V2TagFrame[] |
get(String frameId)
Gets an array of frames with the specified id.
|
String |
getAlbum()
Gets the Album/Movie/Show title.
|
String |
getArtist()
Gets the Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group.
|
ID3V2AttachedPictureFrame[] |
getAttachedPictures()
Gets the attached pictures directly related to the audio file.
|
String |
getBand()
Gets the Band/Orchestra/Accompaniment.
|
String |
getBitsPerMinute()
Gets the number of beats per minute in the main part of the audio.
|
ID3V2CommentFrame[] |
getComments()
Gets the user comments.
|
String |
getComposers()
Gets the composers.
|
String |
getContentType()
Gets the content type.
|
String |
getCopyright()
Gets the copyright message.
|
String |
getDate()
Gets a numeric string in the DDMM format containing the date for the recording.
|
String |
getEncodedBy()
Gets the name of the person or organization that encoded the audio file.
|
String |
getIsrc()
Gets the International Standard Recording Code (ISRC) (12 characters).
|
String |
getLengthInMilliseconds()
Gets the length of the audio file in milliseconds, represented as a numeric string.
|
String |
getMusicalKey()
Gets the musical key in which the sound starts.
|
String |
getOriginalAlbum()
Gets the original album/movie/show title.
|
String |
getPublisher()
Gets the name of the label or publisher.
|
String |
getSizeInBytes()
Gets the size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string.
|
String |
getSoftwareHardware()
Gets the used audio encoder and its settings when the file was encoded.
|
String |
getSubtitle()
Gets the Subtitle/Description refinement.
|
int |
getTagSize()
Gets the size of the tag.
|
String |
getTime()
Gets a numeric string in the HHMM format containing the time for the recording.
|
String |
getTitle()
Gets the Title/Song name/Content description.
|
String |
getTrackNumber()
Gets a numeric string containing the order number of the audio-file on its original recording.
|
Long |
getTrackPlayCounter()
Gets the number of times the file has been played.
|
String |
getVersion()
Gets the ID3 version.
|
String |
getYear()
Gets a numeric string with a year of the recording.
|
void |
remove(ID3V2TagFrame frame)
Removes the specified frame from the tag.
|
void |
removeAttachedPictures()
Removes all attached pictures stored in APIC frames.
|
void |
set(ID3V2TagFrame frame)
Removes all frames having the same id as the specified one and adds the new frame to the tag.
|
void |
setAlbum(String value)
Sets the Album/Movie/Show title.
|
void |
setArtist(String value)
Sets the Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group.
|
void |
setAttachedPictures(ID3V2AttachedPictureFrame[] value)
Sets the attached pictures directly related to the audio file.
|
void |
setBand(String value)
Sets the Band/Orchestra/Accompaniment.
|
void |
setBitsPerMinute(String value)
Sets the number of beats per minute in the main part of the audio.
|
void |
setComments(ID3V2CommentFrame[] value)
Sets the user comments.
|
void |
setComposers(String value)
Sets the composers.
|
void |
setContentType(String value)
Sets the content type.
|
void |
setCopyright(String value)
Sets the copyright message.
|
void |
setDate(String value)
Sets a numeric string in the DDMM format containing the date for the recording.
|
void |
setEncodedBy(String value)
Sets the name of the person or organization that encoded the audio file.
|
void |
setIsrc(String value)
Sets the International Standard Recording Code (ISRC) (12 characters).
|
void |
setLengthInMilliseconds(String value)
Sets the length of the audio file in milliseconds, represented as a numeric string.
|
void |
setMusicalKey(String value)
Sets the musical key in which the sound starts.
|
void |
setOriginalAlbum(String value)
Sets the original album/movie/show title.
|
void |
setPublisher(String value)
Sets the name of the label or publisher.
|
void |
setSizeInBytes(String value)
Sets the size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string.
|
void |
setSoftwareHardware(String value)
Sets the used audio encoder and its settings when the file was encoded.
|
void |
setSubtitle(String value)
Sets the Subtitle/Description refinement.
|
void |
setTime(String value)
Sets a numeric string in the HHMM format containing the time for the recording.
|
void |
setTitle(String value)
Sets the Title/Song name/Content description.
|
void |
setTrackNumber(String value)
Sets a numeric string containing the order number of the audio-file on its original recording.
|
void |
setYear(String value)
Sets a numeric string with a year of the recording.
|
IReadOnlyList<ID3V2TagFrame> |
toList()
Creates a list from the package.
|
addProperties, contains, findProperties, get_Item, getCount, getKeys, getKnowPropertyDescriptors, getMetadataType, getPropertyDescriptors, iterator, removeProperties, sanitize, setProperties, updateProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public String getVersion()
Gets the ID3 version.
getVersion
in class ID3Tag
public final int getTagSize()
Gets the size of the tag.
public final String getAlbum()
Gets the Album/Movie/Show title. This value is represented by the TALB frame.
public final void setAlbum(String value)
Sets the Album/Movie/Show title. This value is represented by the TALB frame.
value
- The Album/Movie/Show title.public final String getArtist()
Gets the Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group. This value is represented by the TPE1 frame.
public final void setArtist(String value)
Sets the Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group. This value is represented by the TPE1 frame.
value
- The Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group.public final String getBand()
Gets the Band/Orchestra/Accompaniment. This value is represented by the TPE2 frame.
public final void setBand(String value)
Sets the Band/Orchestra/Accompaniment. This value is represented by the TPE2 frame.
value
- The Band/Orchestra/Accompaniment.public final String getBitsPerMinute()
Gets the number of beats per minute in the main part of the audio. This value is represented by the TBPM frame.
public final void setBitsPerMinute(String value)
Sets the number of beats per minute in the main part of the audio. This value is represented by the TBPM frame.
value
- The number of beats per minute in the main part of the audio.public final String getComposers()
Gets the composers. The names are separated with the "/" character. This value is represented by the TCOM frame.
public final void setComposers(String value)
Sets the composers. The names are separated with the "/" character. This value is represented by the TCOM frame.
value
- The composers. The names are separated with the "/" character.public final String getContentType()
Gets the content type. This value is represented by the TCON frame.
public final void setContentType(String value)
Sets the content type. This value is represented by the TCON frame.
value
- The content type.public final String getCopyright()
Gets the copyright message. This value is represented by the TCOP frame.
public final void setCopyright(String value)
Sets the copyright message. This value is represented by the TCOP frame.
value
- The copyright message.
public final String getDate()
Gets a numeric string in the DDMM format containing the date for the recording. This field is always four characters long. This value is represented by the TDAT frame.
public final void setDate(String value)
Sets a numeric string in the DDMM format containing the date for the recording. This field is always four characters long. This value is represented by the TDAT frame.
value
- A numeric string in the DDMM format containing the date for the recording.public final String getEncodedBy()
Gets the name of the person or organization that encoded the audio file. This value is represented by the TENC frame.
public final void setEncodedBy(String value)
Sets the name of the person or organization that encoded the audio file. This value is represented by the TENC frame.
value
- The name of the person or organization that encoded the audio file.public final String getPublisher()
Gets the name of the label or publisher. This value is represented by the TPUB frame.
public final void setPublisher(String value)
Sets the name of the label or publisher. This value is represented by the TPUB frame.
value
- The name of the label or publisher.public final String getTime()
Gets a numeric string in the HHMM format containing the time for the recording. This field is always four characters long. This value is represented by the TIME frame.
public final void setTime(String value)
Sets a numeric string in the HHMM format containing the time for the recording. This field is always four characters long. This value is represented by the TIME frame.
value
- A numeric string in the HHMM format containing the time for the recording.public final String getTitle()
Gets the Title/Song name/Content description. This value is represented by the TIT2 frame.
public final void setTitle(String value)
Sets the Title/Song name/Content description. This value is represented by the TIT2 frame.
value
- The Title/Song name/Content description.public final String getSubtitle()
Gets the Subtitle/Description refinement. This value is represented by the TIT3 frame.
public final void setSubtitle(String value)
Sets the Subtitle/Description refinement. This value is represented by the TIT3 frame.
value
- The Subtitle/Description refinement.public final String getMusicalKey()
Gets the musical key in which the sound starts. This value is represented by the TKEY frame.
public final void setMusicalKey(String value)
Sets the musical key in which the sound starts. This value is represented by the TKEY frame.
value
- The musical key in which the sound starts.public final String getLengthInMilliseconds()
Gets the length of the audio file in milliseconds, represented as a numeric string. This value is represented by the TLEN frame.
public final void setLengthInMilliseconds(String value)
Sets the length of the audio file in milliseconds, represented as a numeric string. This value is represented by the TLEN frame.
value
- The length of the audio file in milliseconds, represented as a numeric string.public final String getOriginalAlbum()
Gets the original album/movie/show title. This value is represented by the TOAL frame.
public final void setOriginalAlbum(String value)
Sets the original album/movie/show title. This value is represented by the TOAL frame.
value
- The original album/movie/show title.public final String getTrackNumber()
Gets a numeric string containing the order number of the audio-file on its original recording. This value is represented by the TRCK frame.
public final void setTrackNumber(String value)
Sets a numeric string containing the order number of the audio-file on its original recording. This value is represented by the TRCK frame.
value
- A numeric string containing the order number of the audio-file on its original recordingpublic final String getSizeInBytes()
Gets the size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string. This value is represented by the TSIZ frame.
public final void setSizeInBytes(String value)
Sets the size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string. This value is represented by the TSIZ frame.
value
- The size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string.public final String getIsrc()
Gets the International Standard Recording Code (ISRC) (12 characters). This value is represented by the TSRC frame.
public final void setIsrc(String value)
Sets the International Standard Recording Code (ISRC) (12 characters). This value is represented by the TSRC frame.
value
- The International Standard Recording Code (ISRC) (12 characters).public final String getSoftwareHardware()
Gets the used audio encoder and its settings when the file was encoded. This value is represented by the TSSE frame.
public final void setSoftwareHardware(String value)
Sets the used audio encoder and its settings when the file was encoded. This value is represented by the TSSE frame.
value
- The used audio encoder and its settings when the file was encoded.public final String getYear()
Gets a numeric string with a year of the recording. This frames is always four characters long (until the year 10000). This value is represented by the TYER frame.
public final void setYear(String value)
Sets a numeric string with a year of the recording. This frames is always four characters long (until the year 10000). This value is represented by the TYER frame.
value
- A numeric string with a year of the recording. This frames is always four characters long (until the year 10000).public final ID3V2CommentFrame[] getComments()
Gets the user comments. This value is represented by the COMM frame. The frame is intended for any kind of full text information that does not fit in any other frame.
public final void setComments(ID3V2CommentFrame[] value)
Sets the user comments. This value is represented by the COMM frame. The frame is intended for any kind of full text information that does not fit in any other frame.
value
- The user comments.public final ID3V2AttachedPictureFrame[] getAttachedPictures()
Gets the attached pictures directly related to the audio file. This value is represented by the APIC frame.
public final void setAttachedPictures(ID3V2AttachedPictureFrame[] value)
Sets the attached pictures directly related to the audio file. This value is represented by the APIC frame.
value
- The attached pictures directly related to the audio file.public final Long getTrackPlayCounter()
Gets the number of times the file has been played. This value is represented by the PCNT frame.
public final IReadOnlyList<ID3V2TagFrame> toList()
Creates a list from the package.
public final void removeAttachedPictures()
Removes all attached pictures stored in APIC frames.
public final ID3V2TagFrame[] get(String frameId)
Gets an array of frames with the specified id.
frameId
- The id of the frames to get.public final void set(ID3V2TagFrame frame)
Removes all frames having the same id as the specified one and adds the new frame to the tag.
frame
- The frame to replace all frames of its kind with.public final void clear(String frameId)
Removes all frames with the specified id.
frameId
- The id of the frames to remove.public final void add(ID3V2TagFrame frame)
Adds a frame to the tag.
frame
- The frame to be added to the tag.com.aspose.ms.System.ArgumentException
- The provided frame is incompatible with the existing frames of the same kind.public final void remove(ID3V2TagFrame frame)
Removes the specified frame from the tag.
frame
- The frame to be removed from the tag.