com.groupdocs.metadata.core

Interfaces

Classes

Enums

Exceptions

com.groupdocs.metadata.core

Class ID3V2Tag

  • All Implemented Interfaces:
    Iterable<MetadataProperty>


    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 Detail

      • ID3V2Tag

        public ID3V2Tag()

        Initializes a new instance of the ID3V2Tag class.

    • Method Detail

      • getVersion

        public String getVersion()

        Gets the ID3 version.

        Specified by:
        getVersion in class ID3Tag
        Returns:
        The ID3 version.
      • getTagSize

        public final int getTagSize()

        Gets the size of the tag.

        Returns:
        The size of the tag.
      • getAlbum

        public final String getAlbum()

        Gets the Album/Movie/Show title. This value is represented by the TALB frame.

        Returns:
        The Album/Movie/Show title.
      • setAlbum

        public final void setAlbum(String value)

        Sets the Album/Movie/Show title. This value is represented by the TALB frame.

        Parameters:
        value - The Album/Movie/Show title.
      • getArtist

        public final String getArtist()

        Gets the Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group. This value is represented by the TPE1 frame.

        Returns:
        The Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group.
      • setArtist

        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.

        Parameters:
        value - The Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group.
      • getBand

        public final String getBand()

        Gets the Band/Orchestra/Accompaniment. This value is represented by the TPE2 frame.

        Returns:
        The Band/Orchestra/Accompaniment.
      • setBand

        public final void setBand(String value)

        Sets the Band/Orchestra/Accompaniment. This value is represented by the TPE2 frame.

        Parameters:
        value - The Band/Orchestra/Accompaniment.
      • getBitsPerMinute

        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.

        Returns:
        The number of beats per minute in the main part of the audio.
      • setBitsPerMinute

        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.

        Parameters:
        value - The number of beats per minute in the main part of the audio.
      • getComposers

        public final String getComposers()

        Gets the composers. The names are separated with the "/" character. This value is represented by the TCOM frame.

        Returns:
        The composers. The names are separated with the "/" character.
      • setComposers

        public final void setComposers(String value)

        Sets the composers. The names are separated with the "/" character. This value is represented by the TCOM frame.

        Parameters:
        value - The composers. The names are separated with the "/" character.
      • getContentType

        public final String getContentType()

        Gets the content type. This value is represented by the TCON frame.

        Returns:
        The content type.
      • setContentType

        public final void setContentType(String value)

        Sets the content type. This value is represented by the TCON frame.

        Parameters:
        value - The content type.
      • getCopyright

        public final String getCopyright()

        Gets the copyright message. This value is represented by the TCOP frame.

        Returns:
        The copyright message.


        Every time this field is displayed the field must be preceded with "Copyright ?? ".
      • setCopyright

        public final void setCopyright(String value)

        Sets the copyright message. This value is represented by the TCOP frame.

        Parameters:
        value - The copyright message.


        Every time this field is displayed the field must be preceded with "Copyright ?? ".
      • getDate

        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.

        Returns:
        A numeric string in the DDMM format containing the date for the recording.
      • setDate

        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.

        Parameters:
        value - A numeric string in the DDMM format containing the date for the recording.
      • getEncodedBy

        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.

        Returns:
        The name of the person or organization that encoded the audio file.
      • setEncodedBy

        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.

        Parameters:
        value - The name of the person or organization that encoded the audio file.
      • getPublisher

        public final String getPublisher()

        Gets the name of the label or publisher. This value is represented by the TPUB frame.

        Returns:
        The name of the label or publisher.
      • setPublisher

        public final void setPublisher(String value)

        Sets the name of the label or publisher. This value is represented by the TPUB frame.

        Parameters:
        value - The name of the label or publisher.
      • getTime

        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.

        Returns:
        A numeric string in the HHMM format containing the time for the recording.
      • setTime

        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.

        Parameters:
        value - A numeric string in the HHMM format containing the time for the recording.
      • getTitle

        public final String getTitle()

        Gets the Title/Song name/Content description. This value is represented by the TIT2 frame.

        Returns:
        The Title/Song name/Content description.
      • setTitle

        public final void setTitle(String value)

        Sets the Title/Song name/Content description. This value is represented by the TIT2 frame.

        Parameters:
        value - The Title/Song name/Content description.
      • getSubtitle

        public final String getSubtitle()

        Gets the Subtitle/Description refinement. This value is represented by the TIT3 frame.

        Returns:
        The Subtitle/Description refinement.
      • setSubtitle

        public final void setSubtitle(String value)

        Sets the Subtitle/Description refinement. This value is represented by the TIT3 frame.

        Parameters:
        value - The Subtitle/Description refinement.
      • getMusicalKey

        public final String getMusicalKey()

        Gets the musical key in which the sound starts. This value is represented by the TKEY frame.

        Returns:
        The musical key in which the sound starts.
      • setMusicalKey

        public final void setMusicalKey(String value)

        Sets the musical key in which the sound starts. This value is represented by the TKEY frame.

        Parameters:
        value - The musical key in which the sound starts.
      • getLengthInMilliseconds

        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.

        Returns:
        The length of the audio file in milliseconds, represented as a numeric string.
      • setLengthInMilliseconds

        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.

        Parameters:
        value - The length of the audio file in milliseconds, represented as a numeric string.
      • getOriginalAlbum

        public final String getOriginalAlbum()

        Gets the original album/movie/show title. This value is represented by the TOAL frame.

        Returns:
        The original album/movie/show title.
      • setOriginalAlbum

        public final void setOriginalAlbum(String value)

        Sets the original album/movie/show title. This value is represented by the TOAL frame.

        Parameters:
        value - The original album/movie/show title.
      • getTrackNumber

        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.

        Returns:
        A numeric string containing the order number of the audio-file on its original recording
      • setTrackNumber

        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.

        Parameters:
        value - A numeric string containing the order number of the audio-file on its original recording
      • getSizeInBytes

        public 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.

        Returns:
        The size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string.
      • setSizeInBytes

        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.

        Parameters:
        value - The size of the audio file in bytes, excluding the ID3v2 tag, represented as a numeric string.
      • getIsrc

        public final String getIsrc()

        Gets the International Standard Recording Code (ISRC) (12 characters). This value is represented by the TSRC frame.

        Returns:
        The International Standard Recording Code (ISRC) (12 characters).
      • setIsrc

        public final void setIsrc(String value)

        Sets the International Standard Recording Code (ISRC) (12 characters). This value is represented by the TSRC frame.

        Parameters:
        value - The International Standard Recording Code (ISRC) (12 characters).
      • getSoftwareHardware

        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.

        Returns:
        The used audio encoder and its settings when the file was encoded.
      • setSoftwareHardware

        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.

        Parameters:
        value - The used audio encoder and its settings when the file was encoded.
      • getYear

        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.

        Returns:
        A numeric string with a year of the recording. This frames is always four characters long (until the year 10000).
      • setYear

        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.

        Parameters:
        value - A numeric string with a year of the recording. This frames is always four characters long (until the year 10000).
      • getComments

        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.

        Returns:
        The user comments.
      • setComments

        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.

        Parameters:
        value - The user comments.
      • getAttachedPictures

        public final ID3V2AttachedPictureFrame[] getAttachedPictures()

        Gets the attached pictures directly related to the audio file. This value is represented by the APIC frame.

        Returns:
        The attached pictures directly related to the audio file.
      • setAttachedPictures

        public final void setAttachedPictures(ID3V2AttachedPictureFrame[] value)

        Sets the attached pictures directly related to the audio file. This value is represented by the APIC frame.

        Parameters:
        value - The attached pictures directly related to the audio file.
      • getTrackPlayCounter

        public final Long getTrackPlayCounter()

        Gets the number of times the file has been played. This value is represented by the PCNT frame.

        Returns:
        The number of times a file has been played.
      • toList

        public final IReadOnlyList<ID3V2TagFrame> toList()

        Creates a list from the package.

        Returns:
        A list of all frames contained in the ID3v2 tag.
      • removeAttachedPictures

        public final void removeAttachedPictures()

        Removes all attached pictures stored in APIC frames.

      • get

        public final ID3V2TagFrame[] get(String frameId)

        Gets an array of frames with the specified id.

        Parameters:
        frameId - The id of the frames to get.
        Returns:
        An array of frames with the specified id.
      • set

        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.

        Parameters:
        frame - The frame to replace all frames of its kind with.
      • clear

        public final void clear(String frameId)

        Removes all frames with the specified id.

        Parameters:
        frameId - The id of the frames to remove.
      • add

        public final void add(ID3V2TagFrame frame)

        Adds a frame to the tag.

        Parameters:
        frame - The frame to be added to the tag.
        Throws:
        com.aspose.ms.System.ArgumentException - The provided frame is incompatible with the existing frames of the same kind.
      • remove

        public final void remove(ID3V2TagFrame frame)

        Removes the specified frame from the tag.

        Parameters:
        frame - The frame to be removed from the tag.