Package i5.las2peer.tools
Class SimpleTools
java.lang.Object
i5.las2peer.tools.SimpleTools
public class SimpleTools
extends java.lang.Object
Collection of simple tools not large enough to form a separate class.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringsRandomStringCharSetset with available characters for random string generation viacreateRandomString(int) -
Constructor Summary
Constructors Constructor Description SimpleTools() -
Method Summary
Modifier and Type Method Description static java.lang.StringbyteToHexString(byte[] bytes)static java.lang.StringcreateRandomString(int length)create a random string of the given length with the possible characters fromsRandomStringCharSetstatic intgetSystemDefinedPort()static java.lang.Stringjoin(java.lang.Iterable<?> objects, java.lang.String glue)a simple join method to concatenate String representations of the given objectsstatic java.lang.Stringjoin(java.lang.Object[] objects, java.lang.String glue)a simple join method to concatenate String representations of the given objectsstatic longlongHash(java.lang.String s)Gets a long hash value from a given Stringstatic java.lang.Stringrepeat(java.lang.Object o, int count)repeat the string representation of the given object count timesstatic java.lang.Stringrepeat(java.lang.String string, int count)repeat a String count timesstatic byte[]toByteArray(java.io.InputStream is)
-
Field Details
-
sRandomStringCharSet
public static final java.lang.String sRandomStringCharSetset with available characters for random string generation viacreateRandomString(int)- See Also:
- Constant Field Values
-
-
Constructor Details
-
SimpleTools
public SimpleTools()
-
-
Method Details
-
longHash
public static long longHash(java.lang.String s)Gets a long hash value from a given String- Parameters:
s-- Returns:
- Returns the hash as long number
-
createRandomString
public static java.lang.String createRandomString(int length)create a random string of the given length with the possible characters fromsRandomStringCharSet- Parameters:
length-- Returns:
- a random string
-
join
public static java.lang.String join(java.lang.Object[] objects, java.lang.String glue)a simple join method to concatenate String representations of the given objects- Parameters:
objects-glue-- Returns:
- join string
-
join
public static java.lang.String join(java.lang.Iterable<?> objects, java.lang.String glue)a simple join method to concatenate String representations of the given objects- Parameters:
objects-glue-- Returns:
- join string
-
repeat
public static java.lang.String repeat(java.lang.String string, int count)repeat a String count times- Parameters:
string-count-- Returns:
- concatenated string
-
repeat
public static java.lang.String repeat(java.lang.Object o, int count)repeat the string representation of the given object count times- Parameters:
o-count-- Returns:
- concatenated string
-
toByteArray
public static byte[] toByteArray(java.io.InputStream is) throws java.io.IOException- Throws:
java.io.IOException
-
byteToHexString
public static java.lang.String byteToHexString(byte[] bytes) -
getSystemDefinedPort
public static int getSystemDefinedPort()
-