org.jaudiotagger.tag.id3
Class ID3Tags

java.lang.Object
  extended by org.jaudiotagger.tag.id3.ID3Tags

public class ID3Tags
extends java.lang.Object

This contains static methods that can be performed on tags and to convert between tags.

Version:
$Id: ID3Tags.java,v 1.23 2009/11/12 15:42:57 paultaylor Exp $
Author:
: Paul Taylor, : Eric Farng

Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
private ID3Tags()
           
 
Method Summary
static java.lang.String convertFrameID22To23(java.lang.String identifier)
          Convert from ID3v22 FrameIdentifier to ID3v23
static java.lang.String convertFrameID22To24(java.lang.String identifier)
          Convert from ID3v22 FrameIdentifier to ID3v24
static java.lang.String convertFrameID23To22(java.lang.String identifier)
          Convert from ID3v23 FrameIdentifier to ID3v22
static java.lang.String convertFrameID23To24(java.lang.String identifier)
          Convert from ID3v23 FrameIdentifier to ID3v24
static java.lang.String convertFrameID24To23(java.lang.String identifier)
          Convert from ID3v24 FrameIdentifier to ID3v23
static java.lang.Object copyObject(java.lang.Object copyObject)
          Unable to instantiate abstract classes, so can't call the copy constructor.
static long findNumber(java.lang.String str)
          Find the first whole number that can be parsed from the string
static long findNumber(java.lang.String str, int offset)
          Find the first whole number that can be parsed from the string
static java.lang.String forceFrameID22To23(java.lang.String identifier)
          Force from ID3v22 FrameIdentifier to ID3v23, this is where the frame and structure has changed from v2 to v3 but we can still do some kind of conversion.
static java.lang.String forceFrameID23To22(java.lang.String identifier)
          Force from ID3v22 FrameIdentifier to ID3v23, this is where the frame and structure has changed from v2 to v3 but we can still do some kind of conversion.
static java.lang.String forceFrameID23To24(java.lang.String identifier)
          Force from ID3v2.30 FrameIdentifier to ID3v2.40, this is where the frame and structure has changed from v3 to v4 but we can still do some kind of conversion.
static java.lang.String forceFrameID24To23(java.lang.String identifier)
          Force from ID3v2.40 FrameIdentifier to ID3v2.30, this is where the frame and structure has changed between v4 to v3 but we can still do some kind of conversion.
static long getWholeNumber(java.lang.Object value)
          Given an datatype, try to return it as a long.
static boolean isID3v22FrameIdentifier(java.lang.String identifier)
          Returns true if the identifier is a valid ID3v2.2 frame identifier
static boolean isID3v23FrameIdentifier(java.lang.String identifier)
          Returns true if the identifier is a valid ID3v2.3 frame identifier
static boolean isID3v24FrameIdentifier(java.lang.String identifier)
          Returns true if the identifier is a valid ID3v2.4 frame identifier
static java.lang.String stripChar(java.lang.String str, char ch)
          Remove all occurances of the given character from the string argument.
static java.lang.String truncate(java.lang.String str, int len)
          truncate a string if it longer than the argument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger
Constructor Detail

ID3Tags

private ID3Tags()
Method Detail

isID3v22FrameIdentifier

public static boolean isID3v22FrameIdentifier(java.lang.String identifier)
Returns true if the identifier is a valid ID3v2.2 frame identifier

Parameters:
identifier - string to test
Returns:
true if the identifier is a valid ID3v2.2 frame identifier

isID3v23FrameIdentifier

public static boolean isID3v23FrameIdentifier(java.lang.String identifier)
Returns true if the identifier is a valid ID3v2.3 frame identifier

Parameters:
identifier - string to test
Returns:
true if the identifier is a valid ID3v2.3 frame identifier

isID3v24FrameIdentifier

public static boolean isID3v24FrameIdentifier(java.lang.String identifier)
Returns true if the identifier is a valid ID3v2.4 frame identifier

Parameters:
identifier - string to test
Returns:
true if the identifier is a valid ID3v2.4 frame identifier

getWholeNumber

public static long getWholeNumber(java.lang.Object value)
Given an datatype, try to return it as a long. This tries to parse a string, and takes Long, Short, Byte, Integer objects and gets their value. An exception is not explicitly thrown here because it would causes too many other methods to also throw it.

Parameters:
value - datatype to find long from.
Returns:
long value
Throws:
java.lang.IllegalArgumentException

convertFrameID22To23

public static java.lang.String convertFrameID22To23(java.lang.String identifier)
Convert from ID3v22 FrameIdentifier to ID3v23

Parameters:
identifier -
Returns:

convertFrameID22To24

public static java.lang.String convertFrameID22To24(java.lang.String identifier)
Convert from ID3v22 FrameIdentifier to ID3v24

Parameters:
identifier -
Returns:

convertFrameID23To22

public static java.lang.String convertFrameID23To22(java.lang.String identifier)
Convert from ID3v23 FrameIdentifier to ID3v22

Parameters:
identifier -
Returns:

convertFrameID23To24

public static java.lang.String convertFrameID23To24(java.lang.String identifier)
Convert from ID3v23 FrameIdentifier to ID3v24

Parameters:
identifier -
Returns:

forceFrameID22To23

public static java.lang.String forceFrameID22To23(java.lang.String identifier)
Force from ID3v22 FrameIdentifier to ID3v23, this is where the frame and structure has changed from v2 to v3 but we can still do some kind of conversion.

Parameters:
identifier -
Returns:

forceFrameID23To22

public static java.lang.String forceFrameID23To22(java.lang.String identifier)
Force from ID3v22 FrameIdentifier to ID3v23, this is where the frame and structure has changed from v2 to v3 but we can still do some kind of conversion.

Parameters:
identifier -
Returns:

forceFrameID23To24

public static java.lang.String forceFrameID23To24(java.lang.String identifier)
Force from ID3v2.30 FrameIdentifier to ID3v2.40, this is where the frame and structure has changed from v3 to v4 but we can still do some kind of conversion.

Parameters:
identifier -
Returns:

forceFrameID24To23

public static java.lang.String forceFrameID24To23(java.lang.String identifier)
Force from ID3v2.40 FrameIdentifier to ID3v2.30, this is where the frame and structure has changed between v4 to v3 but we can still do some kind of conversion.

Parameters:
identifier -
Returns:

convertFrameID24To23

public static java.lang.String convertFrameID24To23(java.lang.String identifier)
Convert from ID3v24 FrameIdentifier to ID3v23

Parameters:
identifier -
Returns:

copyObject

public static java.lang.Object copyObject(java.lang.Object copyObject)
Unable to instantiate abstract classes, so can't call the copy constructor. So find out the instantiated class name and call the copy constructor through reflection (e.g for a a FrameBody would have to have a constructor that takes another framebody as the same type as a parameter)

Parameters:
copyObject -
Returns:
Throws:
java.lang.IllegalArgumentException - if no suitable constructor exists

findNumber

public static long findNumber(java.lang.String str)
                       throws TagException
Find the first whole number that can be parsed from the string

Parameters:
str - string to search
Returns:
first whole number that can be parsed from the string
Throws:
TagException

findNumber

public static long findNumber(java.lang.String str,
                              int offset)
                       throws TagException
Find the first whole number that can be parsed from the string

Parameters:
str - string to search
offset - start seaching from this index
Returns:
first whole number that can be parsed from the string
Throws:
TagException
java.lang.NullPointerException
java.lang.IndexOutOfBoundsException

stripChar

public static java.lang.String stripChar(java.lang.String str,
                                         char ch)
Remove all occurances of the given character from the string argument.

Parameters:
str - String to search
ch - character to remove
Returns:
new String without the given charcter

truncate

public static java.lang.String truncate(java.lang.String str,
                                        int len)
truncate a string if it longer than the argument

Parameters:
str - String to truncate
len - maximum desired length of new string
Returns: