public class taUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
stVersion
Contains the version of the class.
|
| Constructor and Description |
|---|
taUtils()
Constructor of the class.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
byteArray2hexString(byte[] input)
Converts a byte array into a hex string with unlimited line length
|
static java.lang.String |
byteArray2hexString(byte[] input,
int start,
int len)
Converts part of a byte array into a hex string with unlimited line length
|
static java.lang.String |
byteArray2hexString(byte[] input,
int start,
int len,
int lineLen)
Converts part of a byte array into a hex string.
|
static boolean |
byteArrayEquals(byte[] first,
byte[] second)
Checks if two byte arrays are the same.
|
static java.lang.String |
getStackTrace(java.lang.Throwable t)
Gets the stack trace in a string
|
static java.lang.String |
getVersion()
Returns the version of the class.
|
static java.lang.String |
getVmName()
Returns the name of the running VM
|
static byte[] |
hexString2byteArray(java.lang.String input)
Converts a hex string into a byte array.
|
static java.lang.String |
hexString2String(java.lang.String input)
Converts a hex string into a character String.
|
static int |
indexOf(java.lang.String[] array,
java.lang.String str)
Gets the index of a String in a String array
|
static double |
parseDouble(java.lang.String s,
double defaultValue) |
static int |
parseInt(java.lang.String s,
int defaultValue)
Calls parseInt(s,10,defaultValue)
|
static int |
parseInt(java.lang.String s,
int radix,
int defaultValue)
Converts a String to an int value.
|
static long |
parseLong(java.lang.String s,
long defaultValue)
Converts a String to a long value.
|
static int |
readIntLE(byte[] source,
int offset,
int numBytes)
This reads an integer value from a byte array with the specified number
of bytes.
|
static java.lang.String |
readLineFromKeyboard()
Reads a line from stdin
|
static int |
searchByteArray(byte[] buffer,
byte[] searchFor,
int start)
Searches a byte array inside another byte array.
|
static java.lang.String |
string2hexString(java.lang.String input)
Converts a String into a hex String.
|
static boolean |
stringContains(java.lang.String bigString,
java.lang.String smallString,
boolean ignoreCase) |
static java.lang.String |
stringFill(java.lang.String Source,
boolean inFront,
char fillChar,
int newLength)
Fills a String with the supplied character until it reaches the supplied lenght.
|
static java.lang.String |
stringJoin(java.lang.String[] data,
java.lang.String separator)
Creates a new string from the strings in data, adding the separator string after every string from data.
|
static java.lang.String |
stringReplace(java.lang.String s,
java.lang.String f,
java.lang.String r)
Replaces all instances of the String f within the String s with the String r.
|
static java.lang.String |
stringReplace(java.lang.String s,
java.lang.String f,
java.lang.String r,
boolean ignoreCase)
Replaces all instances of the String f within the String s with the String r.
|
static java.lang.String |
stringSet(char c,
int length)
Creates a new string where all characters are the same.
|
static java.lang.String[] |
stringSplit(java.lang.String data,
java.lang.String separator)
Creates a new string array from the string in data, splitting when separator is found.
|
protected static java.lang.String stVersion
public taUtils()
public static java.lang.String byteArray2hexString(byte[] input)
input - the byte array to be convertedpublic static java.lang.String byteArray2hexString(byte[] input,
int start,
int len)
input - the byte array to be convertedstart - offset of the starting byte in the arraylen - number of bytes to convertpublic static java.lang.String byteArray2hexString(byte[] input,
int start,
int len,
int lineLen)
input - the byte array to be convertedstart - offset of the starting byte in the arraylen - number of bytes to convertlineLen - length of the hex lines. If 0, the lines are not wrappedpublic static boolean byteArrayEquals(byte[] first,
byte[] second)
first - first byte arraysecond - second byte arraypublic static java.lang.String getStackTrace(java.lang.Throwable t)
t - The Throwable objectpublic static java.lang.String getVersion()
public static java.lang.String getVmName()
public static byte[] hexString2byteArray(java.lang.String input)
input - the hex String to be convertedpublic static java.lang.String hexString2String(java.lang.String input)
input - the hex String to be convertedpublic static int indexOf(java.lang.String[] array,
java.lang.String str)
array - The String arraystr - The string to be foundpublic static double parseDouble(java.lang.String s,
double defaultValue)
public static int parseInt(java.lang.String s,
int defaultValue)
s - String containing the valuedefaultValue - The int value returned on errorpublic static int parseInt(java.lang.String s,
int radix,
int defaultValue)
s - String containing the valueradix - The radix to be useddefaultValue - The int value returned on errorpublic static long parseLong(java.lang.String s,
long defaultValue)
s - String containing the valuedefaultValue - The long value returned on errorpublic static int readIntLE(byte[] source,
int offset,
int numBytes)
source - The source of the bytes.offset - The location in the source.numBytes - The number of bytes to read inpublic static java.lang.String readLineFromKeyboard()
public static int searchByteArray(byte[] buffer,
byte[] searchFor,
int start)
buffer - The byte array that will be searched.searchFor - The byte array that we want to find.start - The start index in the source data.public static java.lang.String string2hexString(java.lang.String input)
input - String to be convertedpublic static boolean stringContains(java.lang.String bigString,
java.lang.String smallString,
boolean ignoreCase)
public static java.lang.String stringFill(java.lang.String Source,
boolean inFront,
char fillChar,
int newLength)
Source - Source StringinFront - If set to true, inserts at the beginning, else at the endfillChar - The character to fill up the StringnewLength - The length to which the returned String should be filled uppublic static java.lang.String stringJoin(java.lang.String[] data,
java.lang.String separator)
data - The string array holding the data.separator - The String that is inserted after every array element
of data .public static java.lang.String stringReplace(java.lang.String s,
java.lang.String f,
java.lang.String r,
boolean ignoreCase)
This method has originally been developed by Bilbowolf.
s - The String that contains the data.f - The String that we want to find.r - The String that we want to use as replacement.ignoreCase - If set to true, the f String will be searched while ignoring the (upper/lower) casepublic static java.lang.String stringReplace(java.lang.String s,
java.lang.String f,
java.lang.String r)
Calls stringReplace (s, f, r, false)
s - The String that contains the data.f - The String that we want to find.r - The String that we want to use as replacement.public static java.lang.String stringSet(char c,
int length)
c - The character to form the String.length - The length the String should have.public static java.lang.String[] stringSplit(java.lang.String data,
java.lang.String separator)
In contast to StringTokenizer, the separator is not a set of single characters, but one complete String. Also, if 2 (or more) separators follow each other immediately, stringSplit will recognize blank Strings between them.
data - The string holding the data.separator - The String that marks where to split data.