public class TcpTools
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
delay(long delayTime)
Halts the current thread for the given amount of time (in ms)
|
static java.lang.String |
intAryToString(int[] ary)
Converts an integer array to a string to restore string data transmitted over
a TcpBridge, TcpAgent link.
|
static java.lang.String |
intAryToString(int[] ary,
int beginIndex)
Converts an integer array to a string to restore string data transmitted over
a TcpBridge, TcpAgent link.
|
static java.lang.String |
intAryToString(int[] ary,
int beginIndex,
int endIndex)
Converts an integer array to a string to restore string data transmitted over
a TcpBridge, TcpAgent link.
|
static java.lang.String[] |
split(java.lang.String s,
java.lang.String separator)
Splits given string with given separator string into multiple strings.
|
static double[] |
splitToDoubleAry(java.lang.String s,
java.lang.String separator)
Splits a line with concatenated doubles separated by the given separator
into single integer values.
|
static int[] |
splitToIntAry(java.lang.String s,
java.lang.String separator)
Splits a line with concatenated integers separated by the given separator
into single integer values.
|
static int[] |
stringToIntAry(java.lang.String s)
Converts a string to an integer array that can be used for transmission over
a TcpBridge, TcpAgent link.
|
static java.lang.String |
stripNickname(java.lang.String nickname)
Returns a nickname where the trailing (n) is removed.
|
static java.lang.String |
stripNickname(java.lang.String nickname,
boolean zeroOnly)
Returns a nickname where the trailing (n) is removed.
|
static int[] |
toIntAry(long n)
Splits the given long (64 bits) into two integers (low-order 32 bits,
high-order 32 bits).
|
static long |
toLong(int low,
int high)
Merges the two given integers (low-order 32 bits, high-order 32 bits)
to a long (64 bits).
|
public static int[] splitToIntAry(java.lang.String s, java.lang.String separator)
s
- the string to split. A separator may or may not end the stringseparator
- the separator used in between each integerpublic static double[] splitToDoubleAry(java.lang.String s, java.lang.String separator)
s
- the string to split. A separator may or may not end the stringseparator
- the separator used in between each doublepublic static java.lang.String[] split(java.lang.String s, java.lang.String separator)
public static int[] stringToIntAry(java.lang.String s)
s
- the string to convertpublic static java.lang.String intAryToString(int[] ary)
ary
- the integer array with the character values of a stringpublic static java.lang.String intAryToString(int[] ary, int beginIndex)
ary
- the integer array with the character values of a string
starting at the given indexbeginIndex
- the index of the the given integer array where the
string representation startspublic static java.lang.String intAryToString(int[] ary, int beginIndex, int endIndex)
ary
- the integer array with the character values of a string
starting at the given index and ending at endIndex - 1beginIndex
- the index of an element of the the given integer array where the
string representation startsendIndex
- the index of one element behind the end of the string represenationpublic static java.lang.String stripNickname(java.lang.String nickname)
nickname
- the nickname to strippublic static java.lang.String stripNickname(java.lang.String nickname, boolean zeroOnly)
nickname
- the nickname to stripzeroOnly
- if true, only (0) is strippedpublic static void delay(long delayTime)
delayTime
- the time to sleeppublic static int[] toIntAry(long n)
n
- the long to splitpublic static long toLong(int low, int high)
low
- the low 32-bit part of the longhigh
- the high 32-bit part of the long