Class InetSocketAddressWrapper
- java.lang.Object
-
- java.net.SocketAddress
-
- java.net.InetSocketAddress
-
- org.drasyl.pipeline.address.InetSocketAddressWrapper
-
- All Implemented Interfaces:
Serializable
,Address
public class InetSocketAddressWrapper extends InetSocketAddress implements Address
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InetSocketAddressWrapper(int port)
Creates a socket address where the IP address is the wildcard address and the port number a specified value.InetSocketAddressWrapper(String hostname, int port)
Creates a socket address from a hostname and a port number.InetSocketAddressWrapper(InetAddress addr, int port)
Creates a socket address from an IP address and a port number.InetSocketAddressWrapper(InetSocketAddress address)
Converts aaddress
to anInetSocketAddress
-
Method Summary
-
Methods inherited from class java.net.InetSocketAddress
createUnresolved, equals, getAddress, getHostName, getHostString, getPort, hashCode, isUnresolved, toString
-
-
-
-
Constructor Detail
-
InetSocketAddressWrapper
public InetSocketAddressWrapper(int port)
Creates a socket address where the IP address is the wildcard address and the port number a specified value.A valid port value is between 0 and 65535. A port number of
zero
will let the system pick up an ephemeral port in abind
operation.- Parameters:
port
- The port number- Throws:
IllegalArgumentException
- if the port parameter is outside the specified range of valid port values.
-
InetSocketAddressWrapper
public InetSocketAddressWrapper(InetAddress addr, int port)
Creates a socket address from an IP address and a port number.A valid port value is between 0 and 65535. A port number of
zero
will let the system pick up an ephemeral port in abind
operation.A
null
address will assign the wildcard address.- Parameters:
addr
- The IP addressport
- The port number- Throws:
IllegalArgumentException
- if the port parameter is outside the specified range of valid port values.
-
InetSocketAddressWrapper
public InetSocketAddressWrapper(String hostname, int port)
Creates a socket address from a hostname and a port number.An attempt will be made to resolve the hostname into an InetAddress. If that attempt fails, the address will be flagged as unresolved.
If there is a security manager, its
checkConnect
method is called with the host name as its argument to check the permission to resolve it. This could result in a SecurityException.A valid port value is between 0 and 65535. A port number of
zero
will let the system pick up an ephemeral port in abind
operation.- Parameters:
hostname
- the Host nameport
- The port number- Throws:
IllegalArgumentException
- if the port parameter is outside the range of valid port values, or if the hostname parameter isnull
.SecurityException
- if a security manager is present and permission to resolve the host name is denied.- See Also:
InetSocketAddress.isUnresolved()
-
InetSocketAddressWrapper
public InetSocketAddressWrapper(InetSocketAddress address)
Converts aaddress
to anInetSocketAddress
- Parameters:
address
- address to be converted- Throws:
IllegalArgumentException
- if the port of the converted address is outside the specified range of valid port values.
-
-