Interface SocketAddress
- All Superinterfaces:
Address
The address of a socket, an inet socket address or a domain socket address.
Use
inetSocketAddress(int, String) to create an inet socket address and domainSocketAddress(String)
to create a domain socket address- Author:
- Tim Fox
-
Method Summary
Modifier and TypeMethodDescriptionstatic SocketAddressdomainSocketAddress(String path) Create a domain socket address from apath.static SocketAddressfromJson(JsonObject json) host()Returns the host name when available or the IP address in string representation.Returns the host IP address when available ornullas a String.hostName()Returns the host name when available ornull
Domain socket address returnsnull.static SocketAddressinetSocketAddress(int port, String host) Create an inet socket address,hostmust be nonnullandportmust be between0and65536.static SocketAddressinetSocketAddress(InetSocketAddress address) Create a inet socket address from a JavaInetSocketAddress.booleanbooleanpath()intport()static SocketAddresssharedRandomPort(int id, String host) Create an inet socket address that binds to a shared random port identified byid.default JsonObjecttoJson()
-
Method Details
-
fromJson
-
inetSocketAddress
Create an inet socket address,hostmust be nonnullandportmust be between0and65536.
Thehoststring can be a host name or a host address.
No name resolution will be attempted.- Parameters:
port- the porthost- the host- Returns:
- the created socket address
-
domainSocketAddress
Create a domain socket address from apath.- Parameters:
path- the address path- Returns:
- the created socket address
-
inetSocketAddress
Create a inet socket address from a JavaInetSocketAddress.
No name resolution will be attempted.- Parameters:
address- the address- Returns:
- the created socket address
-
host
String host()Returns the host name when available or the IP address in string representation.
Domain socket address returnsnull.- Returns:
- the host address
-
hostName
String hostName()Returns the host name when available ornull
Domain socket address returnsnull.- Returns:
- the host name
-
hostAddress
String hostAddress()Returns the host IP address when available ornullas a String.
Domain socket address returnsnull.- Returns:
- the host address
-
port
int port()- Returns:
- the address port or
-1for a domain socket
-
path
String path()- Returns:
- the domain socket path or
nullfor inet socket address, empty path represents unnamed domain socket addresses.
-
isInetSocket
boolean isInetSocket()- Returns:
truefor an inet socket address
-
isDomainSocket
boolean isDomainSocket()- Returns:
truefor an domain socket address
-
toJson
-