API Documentation: Class ServiceAddress
| Name | ServiceAddress |
| Package | com.mckoi.network |
| Implements | java.lang.Comparable |
An address/port of a service in an IP based network, represented as an 128-bit field. The format of the address follows ipv6 conventions.
Constructors Summary
| ServiceAddress(byte[] net_address, int port) | |
| ServiceAddress(java.net.InetAddress inet_address, int port) |
Methods Summary
| byte[] | getAddress() | ||
| int | getPort() | ||
| java.net.InetAddress | asInetAddress() | ||
| static | ServiceAddress | readFrom(DataInput in) | throws IOException |
| void | writeTo(DataOutput out) | throws IOException | |
| static | ServiceAddress | parseString(String str) | throws IOException |
| String | formatString() | ||
| String | displayString() | ||
| String | toString() | ||
| int | hashCode() | ||
| boolean | equals(Object ob) | ||
| int | compareTo(Object ob) |
Constructor Details
ServiceAddress(byte[] net_address, int port)
Constructs the address as a 16 byte ipv6 address and port value.
ServiceAddress(java.net.InetAddress inet_address, int port)
Constructs the address from an InetAddress and port value.
Method Details
byte[] getAddress()
Returns the network address as a 16 byte ipv6 network address. If the address is a 4 byte ipv4 address, it is encoded as an 16 byte ipv6 address over a ipv4 network.
int getPort()
Returns the port of the service.
java.net.InetAddress asInetAddress()
Returns the address as an InetAddress. This will return either an ipv4 or ipv6 InetAddress depending on the format of the network address.
ServiceAddress readFrom(DataInput in)
Reads a ServiceAddress encoded in a data input stream.
void writeTo(DataOutput out)
Encodes this ServiceAddress to a data output stream.
ServiceAddress parseString(String str)
Parses a service address generated from 'formatString'.
String formatString()
Formats this ServiceAddress as a string that can be parsed by 'parseString'.
String displayString()
Returns this ServiceAddress as a string suitable for display to a user.
