Package net.i2p.client.streaming
Class I2PSocketAddress
java.lang.Object
java.net.SocketAddress
net.i2p.client.streaming.I2PSocketAddress
- All Implemented Interfaces:
Serializable
A SocketAddress (Destination + port) so we can have SocketChannels.
Ports are not widely used in I2P, in most cases the port will be zero.
See InetSocketAddress for javadocs.
- Since:
- 0.9.1
- See Also:
-
Constructor Summary
ConstructorDescriptionI2PSocketAddress
(String host) Convenience constructor that parses host:port.I2PSocketAddress
(String host, int port) Does a naming service lookup to resolve the dest.I2PSocketAddress
(Destination dest, int port) Does not do a reverse lookup. -
Method Summary
Modifier and TypeMethodDescriptionstatic I2PSocketAddress
createUnresolved
(String host, int port) boolean
Does a naming service lookup to resolve the dest if this was created unresolved or if the resolution failed in the constructor.int
getPort()
int
hashCode()
boolean
toString()
-
Constructor Details
-
I2PSocketAddress
Convenience constructor that parses host:port. Does a naming service lookup to resolve the dest. May take several seconds for b32.- Parameters:
host
- hostname or b64 dest or b32, may have :port appended- Throws:
IllegalArgumentException
- for port < 0 or port > 65535 or invalid port- Since:
- 0.9.9
-
I2PSocketAddress
Does not do a reverse lookup. Host will be null.- Throws:
IllegalArgumentException
- for port < 0 or port > 65535
-
I2PSocketAddress
Does a naming service lookup to resolve the dest. May take several seconds for b32.- Throws:
IllegalArgumentException
- for port < 0 or port > 65535
-
-
Method Details
-
createUnresolved
- Throws:
IllegalArgumentException
- for port < 0 or port > 65535
-
getPort
public int getPort() -
getAddress
Does a naming service lookup to resolve the dest if this was created unresolved or if the resolution failed in the constructor. If unresolved, this may take several seconds for b32. -
getHostName
- Returns:
- the host only if given in the constructor. Does not do a reverse lookup.
-
isUnresolved
public boolean isUnresolved() -
toString
-
equals
-
hashCode
public int hashCode()
-