How can I insert an ID3 tag longer than 30 characters?
<p>I realize it would be easier to use a library like mp3agic or jaudiotagger but I wanted to edit id3 tags manually for learning purposes.</p>

<p>I have code set up to get the tags properly, however I noticed that for some songs the title is cut at 30 characters however when I open the .mp3 file in a music player the full title is shown, which is longer than 30 characters.</p>

<p>This is the code that I'm using right now to view the tags:</p>

<pre><code>            File mp3File = new File(filePath);

            byte[] mp3Meta = new byte[128];

            try {
                //convert file into array of bytes
                fileReader = new FileInputStream(mp3File);
                fileReader.skip((int)mp3File.length() - 128);
                fileReader.read(mp3Meta);
                String id3 = new String(mp3Meta); 

                String tag = id3.substring(0, 3); 
               if (tag.equals("TAG")) {
                System.out.println("\nTitle: " + id3.substring(3, 32) + "\n" +
                    "Artist: " + id3.substring(33, 62) + "\n" +
                    "Album: " + id3.substring(63, 91) + "\n" +
                    "Year: " + id3.substring(93, 97) + "\n" +
                    "************************************************");
               } else {
                System.out.println("File has no ID3 tags..");
               }
            }catch(Exception e){
                e.printStackTrace();
            }
</code></pre>

<p>I have an idea as to how I can edit the tags, but how can I get the full title (or any tag) if it's longer than 30 characters? I read there was a way to add a tag longer than 30 characters in id3v2 but I'm not sure how to access id3v2 frames</p>

<p>I believe I have to determine which version (id3v1 or id3v2) the mp3 is using, but I'm not sure how to do that programmatically either.</p>