Java InetAddress normalizeHostAddress(final InetAddress localHost)

Here you can find the source of normalizeHostAddress(final InetAddress localHost)

Description

normalize Host Address

License

Apache License

Declaration

public static String normalizeHostAddress(final InetAddress localHost) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.net.Inet6Address;
import java.net.InetAddress;

public class Main {
    public static String normalizeHostAddress(final InetAddress localHost) {
        if (localHost instanceof Inet6Address) {
            return "[" + localHost.getHostAddress() + "]";
        } else {/*  www . ja v a2  s  .  c  o m*/
            return localHost.getHostAddress();
        }
    }
}

Related

  1. inetAddressesCompare(final InetAddress[] addresses1, final InetAddress[] addresses2)
  2. inetAddressFromThriftString(String ipAddress)
  3. inetAddressGt(InetAddress a, InetAddress b)
  4. inetAddrToByteArray(InetAddress a)
  5. newInterfaceAddress(InetAddress inetAddress, short maskLength)
  6. parseInetAddressFromString(String input)
  7. readInetAddress(final DataInput in, final boolean fixedLength)
  8. readInetAddress(final String stringInetAddress)
  9. remove(InetAddress[] a_, InetAddress b)