com.voxbiblia.id3j
Class ID3Tool

java.lang.Object
  extended by com.voxbiblia.id3j.ID3Tool

public class ID3Tool
extends Object

A tool class used to serialize audio metadata for inclusion into an ID3 tag.


Constructor Summary
ID3Tool()
           
 
Method Summary
static int getTagLength(byte[] tagHeader)
          Parses the tag header (the first 10 bytes of the ID3v2 tag) and returns the length of the tag in bytes, excluding the header.
static byte[] merge(byte[] existing, ID3Tag updatedValues)
          Reads a serialized ID3 tag from existing and updates all frames that is set in the tag updatedValues.
static void writeToFile(File target, ID3Tag tag)
          Converts the given tag instance to an ID3v2.3 byte stream and adds it to the target, replacing any existing tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ID3Tool

public ID3Tool()
Method Detail

merge

public static byte[] merge(byte[] existing,
                           ID3Tag updatedValues)
Reads a serialized ID3 tag from existing and updates all frames that is set in the tag updatedValues.

Parameters:
existing - the incoming ID3v23 byte stream
updatedValues - the ID3Tag to read new values from
Returns:
an updated byte stream

writeToFile

public static void writeToFile(File target,
                               ID3Tag tag)
Converts the given tag instance to an ID3v2.3 byte stream and adds it to the target, replacing any existing tag.

Parameters:
tag - the tag to write
target - the file to write it to

getTagLength

public static int getTagLength(byte[] tagHeader)
Parses the tag header (the first 10 bytes of the ID3v2 tag) and returns the length of the tag in bytes, excluding the header.

Parameters:
tagHeader - the ten first bytes of the tag
Returns:
the total length of the ID3v2 tag excluding the header.