|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.qfs.lib.util.Misc
A collection of miscellaneous utility functions.
Constructor Summary | |
Misc()
|
Method Summary | |
static int |
countLines(java.lang.String text)
Count the number of lines in a text String. |
static boolean |
equalOrEmpty(java.lang.String s1,
java.lang.String s2)
Test whether two Strings are equal or both empty or null. |
static boolean |
equalOrNull(java.lang.Object o1,
java.lang.Object o2)
Test whether two objects are equal or both null. |
static byte[] |
fromHex(java.lang.String hex)
Convert a hex String into a byte array. |
static int |
getMajorJavaVersion()
Get the major version of the Java VM. |
static int |
getMediumJavaVersion()
Get the medium version of the Java VM. |
static int |
getMinorJavaVersion()
Get the minor version of the Java VM. |
static boolean |
isJavaVersion(int major,
int medium,
int minor)
Test whether the version of the Java VM matches a given version. |
static boolean |
isJavaVersionAtLeast(int major,
int medium,
int minor)
Test whether the version of the Java VM is at least a given version. |
static java.lang.String |
lineSepToLineFeed(java.lang.String text)
Convert system specific line separators in a String to just line feed characters. |
static java.lang.String |
quote(java.lang.String data,
java.lang.String toQuote)
Quote special characters in a String with a backslash. |
static java.lang.String |
quote(java.lang.String data,
java.lang.String toQuote,
char quote)
Quote special characters in a String. |
static java.lang.String[] |
splitLines(java.lang.String text)
Split a text into lines. |
static java.lang.String |
toHex(byte[] data)
Convert a byte array into a hex string. |
static java.lang.String |
toHex(byte[] data,
int start,
int count)
Convert a byte array into a hex string. |
static java.lang.String |
unquote(java.lang.String data,
java.lang.String toQuote)
Unquote special characters in a String, quoted with a backslash. |
static java.lang.String |
unquote(java.lang.String data,
java.lang.String toQuote,
char quote)
Unquote special characters in a String. |
static int |
unquotedIndexOf(java.lang.String data,
java.lang.String chars,
int start)
Find the index of an unquoted version of a character in a String. |
static int |
unquotedIndexOf(java.lang.String data,
java.lang.String chars,
int start,
char quote)
Find the index of an unquoted version of a character in a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Misc()
Method Detail |
public static boolean equalOrNull(java.lang.Object o1, java.lang.Object o2)
o1
- The first object.o2
- The second object.
public static boolean equalOrEmpty(java.lang.String s1, java.lang.String s2)
s1
- The first String.s2
- The second String.
public static java.lang.String lineSepToLineFeed(java.lang.String text)
text
- The input string.
public static int countLines(java.lang.String text)
text
- The input text.
public static java.lang.String[] splitLines(java.lang.String text)
text
- The input text.
public static java.lang.String quote(java.lang.String data, java.lang.String toQuote)
data
- The string.toQuote
- The characters to quote. Don't forget to add the
backslash itself.
public static java.lang.String quote(java.lang.String data, java.lang.String toQuote, char quote)
data
- The string.toQuote
- The characters to quote. Don't forget to add the quote
character itself.quote
- The quote character.
public static java.lang.String unquote(java.lang.String data, java.lang.String toQuote)
data
- The string.toQuote
- The characters to quote. Don't forget to add the
backslash itself.
public static java.lang.String unquote(java.lang.String data, java.lang.String toQuote, char quote)
data
- The string.toQuote
- The characters to quote. Don't forget to add the quote
character itself.quote
- The quote character.
public static int unquotedIndexOf(java.lang.String data, java.lang.String chars, int start)
data
- The String.chars
- The characters to look for.start
- The position to start the search at.
public static int unquotedIndexOf(java.lang.String data, java.lang.String chars, int start, char quote)
data
- The String.chars
- The characters to look for.start
- The position to start the search at.quote
- The quote character.
public static java.lang.String toHex(byte[] data)
data
- The data to convert.
public static java.lang.String toHex(byte[] data, int start, int count)
data
- The data to convert.start
- Start conversion at this position.count
- Convert that many bytes.
public static byte[] fromHex(java.lang.String hex) throws java.lang.IllegalArgumentException
hex
- The input String.
java.lang.IllegalArgumentException
- If the string contains non-hex
characters.public static int getMajorJavaVersion()
public static int getMediumJavaVersion()
public static int getMinorJavaVersion()
public static boolean isJavaVersion(int major, int medium, int minor)
major
- The major version to test, -1 to ignore.medium
- The medium version to test, -1 to ignore.minor
- The minor version to test, -1 to ignore.
public static boolean isJavaVersionAtLeast(int major, int medium, int minor)
major
- The major version to test, -1 to ignore.medium
- The medium version to test, -1 to ignore.minor
- The minor version to test, -1 to ignore.
|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |