|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.farng.mp3.TagUtility
This is a holder class that contains static methods that I use in my library. They may or may not be useful for anyone else extending the library.
Method Summary | |
static java.lang.String |
addTimeStampToTextArea(java.lang.String text,
int origPos)
Add a timestamp string to a given string. |
static java.lang.String |
appendBeforeExtension(java.lang.String filename,
java.lang.String addition)
|
static java.lang.String |
convertFrameID2_2to2_3(java.lang.String identifier)
|
static java.lang.String |
convertFrameID2_2to2_4(java.lang.String identifier)
|
static java.lang.String |
convertFrameID2_3to2_2(java.lang.String identifier)
|
static java.lang.String |
convertFrameID2_3to2_4(java.lang.String identifier)
|
static java.lang.String |
convertFrameID2_4to2_2(java.lang.String identifier)
|
static java.lang.String |
convertFrameID2_4to2_3(java.lang.String identifier)
|
static void |
copyFile(java.io.File source,
java.io.File destination)
Copy the source file to the destination file. |
static java.lang.Object |
copyObject(java.lang.Object copyObject)
Unable to instantiate abstract classes, so can't call the copy constructor. |
static int |
findMatchingParenthesis(java.lang.String str,
int index)
return the index of the matching of parenthesis. |
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 |
getFrameDescription(java.lang.String identifier)
Given an ID, get the ID3v2 frame description or the Lyrics3 field description. |
static long |
getWholeNumber(java.lang.Object value)
Given an object, try to return it as a long . |
static boolean |
isID3v2_2FrameIdentifier(java.lang.String identifier)
Returns true if the identifier is a valid ID3v2.2 frame identifier |
static boolean |
isID3v2_3FrameIdentifier(java.lang.String identifier)
Returns true if the identifier is a valid ID3v2.3 frame identifier |
static boolean |
isID3v2_4FrameIdentifier(java.lang.String identifier)
Returns true if the identifier is a valid ID3v2.4 frame identifier |
static boolean |
isLyrics3v2FieldIdentifier(java.lang.String identifier)
Returns true if the identifier is a valid Lyrics3v2 frame identifier |
static boolean |
isMatchingParenthesis(java.lang.String str)
Returns true if the string has matching parenthesis. |
static java.lang.String |
padString(java.lang.String str,
int length,
char ch,
boolean padBefore)
String formatting function to pad the given string with the given character |
static java.lang.String |
replaceEOLNwithCRLF(java.lang.String text)
Replace the Unix end of line character with the DOS end of line character. |
static java.lang.String |
replaceWord(java.lang.String source,
java.lang.String oldString,
java.lang.String newString)
Search the source string for any occurance of oldString and replaced them all with
newString . |
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 |
toSentenceCase(java.lang.String str,
boolean keepUppercase)
Change the given string into sentence case. |
static java.lang.String |
toTitleCase(java.lang.String str,
boolean keepUppercase)
Change the given string to title case. |
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 |
Method Detail |
public static java.lang.String getFrameDescription(java.lang.String identifier)
identifier
- frame identifier
public static boolean isID3v2_2FrameIdentifier(java.lang.String identifier)
identifier
- string to test
public static boolean isID3v2_3FrameIdentifier(java.lang.String identifier)
identifier
- string to test
public static boolean isID3v2_4FrameIdentifier(java.lang.String identifier)
identifier
- string to test
public static boolean isLyrics3v2FieldIdentifier(java.lang.String identifier)
identifier
- string to test
public static boolean isMatchingParenthesis(java.lang.String str)
str
- string to test
public static long getWholeNumber(java.lang.Object value)
long
. This tries to parse a string, and takes Long,
Short, Byte, Integer
objects and gets their value. An exception is not explicityly thrown here because it
would causes too many other methods to also throw it.
value
- object to find long from.
long
valuepublic static java.lang.String addTimeStampToTextArea(java.lang.String text, int origPos)
text
- textarea string to insert toorigPos
- current position of the cursor
public static java.lang.String appendBeforeExtension(java.lang.String filename, java.lang.String addition)
public static java.lang.String convertFrameID2_2to2_3(java.lang.String identifier)
public static java.lang.String convertFrameID2_2to2_4(java.lang.String identifier)
public static java.lang.String convertFrameID2_3to2_2(java.lang.String identifier)
public static java.lang.String convertFrameID2_3to2_4(java.lang.String identifier)
public static java.lang.String convertFrameID2_4to2_2(java.lang.String identifier)
public static java.lang.String convertFrameID2_4to2_3(java.lang.String identifier)
public static void copyFile(java.io.File source, java.io.File destination) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public static java.lang.Object copyObject(java.lang.Object copyObject)
public static int findMatchingParenthesis(java.lang.String str, int index)
str
- string to searchindex
- index of string to start searching. This index should point to the opening parenthesis.
public static long findNumber(java.lang.String str) throws TagException
str
- string to search
TagException
public static long findNumber(java.lang.String str, int offset) throws TagException
str
- string to searchoffset
- start seaching from this index
TagException
public static java.lang.String padString(java.lang.String str, int length, char ch, boolean padBefore)
str
- string to padlength
- total length of new stringch
- character to pad the string withpadBefore
- if true, add the padding at the start of the string. if false, add the padding at the end of the
string.
public static java.lang.String replaceEOLNwithCRLF(java.lang.String text)
text
- string to search and replace
public static java.lang.String replaceWord(java.lang.String source, java.lang.String oldString, java.lang.String newString)
source
string for any occurance of oldString
and replaced them all with
newString
. This searches for the entire word of old string. A blank space is appended to the front
and back of oldString
public static java.lang.String stripChar(java.lang.String str, char ch)
str
- String to searchch
- character to remove
public static java.lang.String toSentenceCase(java.lang.String str, boolean keepUppercase)
TagConstants.upperLowerCase
will be capitalized that way. Any other words will be turned lower
case.
str
- String to modifykeepUppercase
- if true, keep a word if it is already all in UPPERCASE
public static java.lang.String toTitleCase(java.lang.String str, boolean keepUppercase)
TagConstants.upperLowerCase
will be capitalized that way. Any other words will be capitalized.
str
- String to modifykeepUppercase
- if true, keep a word if it is already all in UPPERCASE
public static java.lang.String truncate(java.lang.String str, int len)
str
- String to truncatelen
- maximum desired length of new string
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |