Java Utililty Methods InetAddress

List of utility methods to do InetAddress

Description

The list of methods to do InetAddress are organized into topic(s).

Method

intsortKey(InetAddress address, boolean prefer_v6)
Sorts an address by preference.
int key = address.getAddress().length;
if (prefer_v6) {
    key = -key;
if (address.isAnyLocalAddress()) {
    key += 5;
if (address.isMulticastAddress()) {
...
StringtoStringWithNoHostname(InetAddress address)
to String With No Hostname
String addr = address.toString();
int i = addr.indexOf('/');
if (i == -1) {
    throw new IllegalArgumentException("InetAddress does not contain / character");
return addr.substring(i + 1, addr.length());
voidwriteInetAddress(final InetAddress inetAddress, final DataOutput out, final boolean fixedLength)
write Inet Address
if (inetAddress == null) {
    out.writeBoolean(true);
    if (fixedLength) {
        out.writeByte(0);
        out.writeLong(0);
        out.writeLong(0);
} else {
...