|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object anon.util.Util
public final class Util
Nested Class Summary | |
---|---|
static interface |
Util.Comparable
|
static class |
Util.IntegerSortAsc
|
static class |
Util.IntegerSortDesc
|
static class |
Util.LongSortAsc
|
static class |
Util.LongSortDesc
|
static class |
Util.StringSortAsc
|
Field Summary | |
---|---|
static int |
MAX_FORMAT_ALL
|
static int |
MAX_FORMAT_BYTES
|
static int |
MAX_FORMAT_GBIT_PER_SEC
|
static int |
MAX_FORMAT_GBYTES
|
static int |
MAX_FORMAT_KBIT_PER_SEC
|
static int |
MAX_FORMAT_KBYTES
|
static int |
MAX_FORMAT_MBIT_PER_SEC
|
static int |
MAX_FORMAT_MBYTES
|
static java.lang.String |
VERSION_FORMAT
Defines the format of version numbers in the AN.ON project. |
private static java.lang.String |
WHITESPACE
|
private static java.lang.String |
WHITESPACE_ENCODED
|
Constructor Summary | |
---|---|
private |
Util()
This class works without being initialised and is completely static. |
Method Summary | |
---|---|
static boolean |
arraysEqual(byte[] arrayOne,
byte[] arrayTwo)
Tests if two byte arrays are equal. |
static boolean |
arraysEqual(byte[] a_arrayA,
int a_Aoff,
byte[] a_arrayB,
int a_Boff,
int a_length)
Tests if a_length positions of two arrays are equal. |
static boolean |
arraysEqual(char[] arrayOne,
char[] arrayTwo)
Tests if two charactet arrays are equal. |
private static void |
bubbleSortStrings(java.util.Vector a_vector,
java.lang.String[] buffer,
int[] bufferIndices)
Uses the Bubble Sort method to sort a vector of objects by comparing the output of the toString() method. |
static void |
closeStream(java.io.InputStream a_input)
|
static void |
closeStream(java.io.OutputStream a_input)
|
static java.lang.String |
colonizeSKI(java.lang.String a_ski)
|
static long |
convertVersionStringToNumber(java.lang.String a_version)
Converts a version string of the form xx.xx.xxx to a number |
static void |
copyStream(java.io.InputStream a_input,
java.io.OutputStream a_output)
|
static InfoServiceDBEntry[] |
createDefaultInfoServices(java.lang.String[] a_defaultNames,
java.lang.String[] a_defaultHostNames,
int[][] a_defaultPortNumbers)
|
static java.lang.String |
cutString(java.lang.String a_string,
int a_maxLength)
|
private static int |
divide(java.lang.String[] a_IDs,
java.lang.String[] a_values,
int a_left,
int a_right)
|
private static int |
divide(java.util.Vector a_vec,
int a_left,
int a_right,
Util.Comparable c)
|
static java.lang.String |
encodeWhiteSpaces(java.lang.String stringWithWhitespaces)
|
static java.lang.String |
formatBytesValueOnlyUnit(long c)
|
static java.lang.String |
formatBytesValueOnlyUnit(long c,
int a_maxFormat)
|
static java.lang.String |
formatBytesValueWithoutUnit(long c)
|
static java.lang.String |
formatBytesValueWithoutUnit(long c,
int a_maxFormat)
Returns a formated number which respects different units (Bytes, kBytes, MBytes, GBytes) |
static java.lang.String |
formatBytesValueWithUnit(long c)
Returns the desired unit for this amount of Bytes (Bytes, kBytes, MBytes,GBytes) |
static java.lang.String |
formatBytesValueWithUnit(long c,
int a_maxFormat)
|
static java.lang.String |
formatKbitPerSecValueOnlyUnit(long c)
|
static java.lang.String |
formatKbitPerSecValueOnlyUnit(long c,
int a_maxFormat)
|
static java.lang.String |
formatKbitPerSecValueWithoutUnit(long c)
|
static java.lang.String |
formatKbitPerSecValueWithoutUnit(long c,
int a_maxFormat)
|
static java.lang.String |
formatKbitPerSecValueWithUnit(long c)
|
static java.lang.String |
formatKbitPerSecValueWithUnit(long c,
int a_maxFormat)
|
static java.lang.String |
getStackTrace(java.lang.Throwable a_t)
Gets the stack trace of a Throwable as String. |
static java.lang.String |
getStaticFieldValue(java.lang.Class a_class,
java.lang.String a_fieldName)
Uses the reflection API to get the value of a static field in the given class, if the field is present. |
private static boolean |
isUmlaut(char a_character,
java.lang.String[] a_transformedUmlauts,
int a_position)
Tests if a character is an umlaut and, if yes, writes the umlaut in an ASCII form to the array of transformed umlauts at the specified position. |
static java.lang.String |
normaliseString(java.lang.String a_string,
int a_normLength)
Normalises a String to the given length by filling it up with spaces, if it does not already have this length or is even longer. |
static double |
parseDouble(java.lang.String a_string)
Implementation of parseFloat not implemented in JDK 1.1.8 |
private static void |
quicksort(java.lang.String[] a_IDs,
java.lang.String[] a_values,
int a_left,
int a_right)
|
private static void |
quicksort(java.util.Vector a_vec,
int a_left,
int a_right,
Util.Comparable c)
|
static java.lang.String |
replaceAll(java.lang.String a_source,
java.lang.String a_toReplace,
java.lang.String a_replaceWith)
Since JDK 1.1.8 does not provide String.replaceAll(), this is an equivalent method. |
static java.lang.String |
replaceAll(java.lang.String a_source,
java.lang.String a_toReplace,
java.lang.String a_replaceWith,
java.lang.String[] omit)
String replace algorithm. |
static void |
sort(java.lang.String[] a_ids,
java.lang.String[] a_values)
|
static void |
sort(java.util.Vector a_vec,
Util.Comparable c)
|
static java.util.Vector |
sortStrings(java.util.Vector a_vector)
Sorts a Vector alphabetically using the toString() method of each object. |
static java.lang.String |
stripString(java.lang.String a_string,
java.lang.String a_charactersToStrip)
|
private static void |
swap(java.lang.String[] a_IDs,
java.lang.String[] a_values,
int a,
int b)
|
private static void |
swap(java.util.Vector a_vec,
int a,
int b)
|
static java.lang.Object[] |
toArray(java.lang.Object a_object)
Creates an Object array from a single Object. |
static java.lang.String |
toHTMLEntities(java.lang.String buf)
|
static java.util.Vector |
toVector(java.lang.Object a_object)
Creates a Vector from a single Object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION_FORMAT
private static final java.lang.String WHITESPACE_ENCODED
private static final java.lang.String WHITESPACE
public static final int MAX_FORMAT_BYTES
public static final int MAX_FORMAT_KBYTES
public static final int MAX_FORMAT_MBYTES
public static final int MAX_FORMAT_GBYTES
public static final int MAX_FORMAT_KBIT_PER_SEC
public static final int MAX_FORMAT_MBIT_PER_SEC
public static final int MAX_FORMAT_GBIT_PER_SEC
public static final int MAX_FORMAT_ALL
Constructor Detail |
---|
private Util()
Method Detail |
---|
public static java.lang.String cutString(java.lang.String a_string, int a_maxLength)
public static java.lang.String stripString(java.lang.String a_string, java.lang.String a_charactersToStrip)
public static java.lang.String normaliseString(java.lang.String a_string, int a_normLength)
a_string
- a Stringa_normLength
- a length to normalise the String
public static java.lang.String getStackTrace(java.lang.Throwable a_t)
a_t
- a Throwable
public static boolean arraysEqual(byte[] arrayOne, byte[] arrayTwo)
arrayOne
- a byte arrayarrayTwo
- another byte array
public static boolean arraysEqual(char[] arrayOne, char[] arrayTwo)
arrayOne
- a charactet arrayarrayTwo
- another charactet array
public static final boolean arraysEqual(byte[] a_arrayA, int a_Aoff, byte[] a_arrayB, int a_Boff, int a_length)
a_arrayA
- byte[]a_Aoff
- inta_arrayB
- byte[]a_Boff
- inta_length
- int
public static java.util.Vector toVector(java.lang.Object a_object)
a_object
- an Object
public static java.lang.Object[] toArray(java.lang.Object a_object)
a_object
- an Object
private static void swap(java.lang.String[] a_IDs, java.lang.String[] a_values, int a, int b)
public static java.util.Vector sortStrings(java.util.Vector a_vector)
a_vector
- a Vector
public static double parseDouble(java.lang.String a_string) throws java.lang.NumberFormatException
a_string
- String
java.lang.NumberFormatException
public static void sort(java.lang.String[] a_ids, java.lang.String[] a_values)
private static int divide(java.lang.String[] a_IDs, java.lang.String[] a_values, int a_left, int a_right)
private static void quicksort(java.lang.String[] a_IDs, java.lang.String[] a_values, int a_left, int a_right)
public static void sort(java.util.Vector a_vec, Util.Comparable c)
private static int divide(java.util.Vector a_vec, int a_left, int a_right, Util.Comparable c)
private static void quicksort(java.util.Vector a_vec, int a_left, int a_right, Util.Comparable c)
private static void swap(java.util.Vector a_vec, int a, int b)
private static void bubbleSortStrings(java.util.Vector a_vector, java.lang.String[] buffer, int[] bufferIndices)
a_vector
- a Vectorbuffer
- a bufferbufferIndices
- indices for the bufferprivate static boolean isUmlaut(char a_character, java.lang.String[] a_transformedUmlauts, int a_position)
a_character
- a character; must be lower case !a_transformedUmlauts
- an array of transformed umlautsa_position
- the position to write into the array of umlauts; if the character is not an umlaut,
'null' is written at this position, otherwise the character transformed into an ASCII form
public static long convertVersionStringToNumber(java.lang.String a_version) throws java.lang.NumberFormatException
a_version
- a version string of the form xx.xx.xxx
java.lang.NumberFormatException
- if the version has an illegal formatpublic static java.lang.String replaceAll(java.lang.String a_source, java.lang.String a_toReplace, java.lang.String a_replaceWith)
public static java.lang.String replaceAll(java.lang.String a_source, java.lang.String a_toReplace, java.lang.String a_replaceWith, java.lang.String[] omit)
a_source
- Source Stringa_toReplace
- substring which is to be replaceda_replaceWith
- string which should replace a_toReplaceomit
- Strings that not be replaced when their prefix matches a_toReplace
public static java.lang.String encodeWhiteSpaces(java.lang.String stringWithWhitespaces)
public static void closeStream(java.io.InputStream a_input)
public static void closeStream(java.io.OutputStream a_input)
public static void copyStream(java.io.InputStream a_input, java.io.OutputStream a_output) throws java.io.IOException
java.io.IOException
public static java.lang.String getStaticFieldValue(java.lang.Class a_class, java.lang.String a_fieldName)
a_class
- a Classa_fieldName
- the field to read the value from
public static java.lang.String colonizeSKI(java.lang.String a_ski)
public static InfoServiceDBEntry[] createDefaultInfoServices(java.lang.String[] a_defaultNames, java.lang.String[] a_defaultHostNames, int[][] a_defaultPortNumbers) throws java.lang.Exception
java.lang.Exception
public static java.lang.String formatKbitPerSecValueWithUnit(long c)
public static java.lang.String formatKbitPerSecValueWithUnit(long c, int a_maxFormat)
public static java.lang.String formatKbitPerSecValueOnlyUnit(long c)
public static java.lang.String formatKbitPerSecValueOnlyUnit(long c, int a_maxFormat)
public static java.lang.String formatKbitPerSecValueWithoutUnit(long c)
public static java.lang.String formatKbitPerSecValueWithoutUnit(long c, int a_maxFormat)
public static java.lang.String formatBytesValueWithUnit(long c)
public static java.lang.String formatBytesValueWithUnit(long c, int a_maxFormat)
public static java.lang.String formatBytesValueOnlyUnit(long c)
public static java.lang.String formatBytesValueOnlyUnit(long c, int a_maxFormat)
public static java.lang.String formatBytesValueWithoutUnit(long c)
public static java.lang.String formatBytesValueWithoutUnit(long c, int a_maxFormat)
public static java.lang.String toHTMLEntities(java.lang.String buf)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |