|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindbright.util.Util
public final class Util
Miscellaneous utility functions
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static byte[] |
byteArrayFromHexString(java.lang.String in)
Convert an hex-string to byte array "0001a0" -> {0x00, 0x01, 0xa0} |
static java.lang.String |
getHost(java.lang.String address)
Extracts the host part of an address string. |
static int |
getPort(java.lang.String address,
int def)
Extracts the host part of an address string. |
static java.lang.Object[] |
parseForwardSpec(java.lang.String spec,
java.lang.Object local)
Parses a port forward spec of the following format: /plugin/local_host:local_port:remote_host:remote_port
Where /plugin/ and local_host: are
optional. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static java.lang.String getHost(java.lang.String address)
host:port
where the ":port" part is optional. The host part is either a
name or an IPv4 address. The host may also be an IPv6 literal
address enclosed in brackets ([]
).
address
- the string to extract data from
public static int getPort(java.lang.String address, int def)
host:port
where the ":port" part is optional. The host part is either a
name or an IPv4 address. The host may also be an IPv6 literal
address enclosed in brackets ([]
).
address
- the string to extract data fromdef
- default port number to return if the address does not
contain any port definition.
public static java.lang.Object[] parseForwardSpec(java.lang.String spec, java.lang.Object local) throws java.lang.IllegalArgumentException
/plugin/local_host:local_port:remote_host:remote_port
Where /plugin/
and local_host:
are
optional.
local_host and remote_host may be names or literal IPv4
addreses. They can also be literal IPv6 addresses enclosed in
([]
).
spec
- the port forward speclocal
- defaukt local listenber address
java.lang.IllegalArgumentException
public static byte[] byteArrayFromHexString(java.lang.String in)
hex
- a hexadecimal string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |