android/guava/src/com/google/common/net/InetAddresses.java
public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) {
    if (isCompatIPv4Address(ip)) {
      return getCompatIPv4Address(ip);
    }

    if (is6to4Address(ip)) {
      return get6to4IPv4Address(ip);
    }

    if (isTeredoAddress(ip)) {
      return getTeredoInfo(ip).getClient();
    }

    throw formatIllegalArgumentException("'%s' has no embedded IPv4 address.", toAddrString(ip));
  }
public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) {
    if (isCompatIPv4Address(ip)) {
      return getCompatIPv4Address(ip);
    }

    if (is6to4Address(ip)) {
      return get6to4IPv4Address(ip);
    }

    if (isTeredoAddress(ip)) {
      return getTeredoInfo(ip).getClient();
    }

    throw formatIllegalArgumentException("'%s' has no embedded IPv4 address.", toAddrString(ip));
  }
public static Inet4Address getEmbeddedIPv4ClientAddress ( Inet6Address ip ) { if ( isCompatIPv4Address ( ip ) ) { return getCompatIPv4Address ( ip ) ; } if ( is6to4Address ( ip ) ) { return get6to4IPv4Address ( ip ) ; } if ( isTeredoAddress ( ip ) ) { return getTeredoInfo ( ip ) . getClient ( ) ; } throw formatIllegalArgumentException ( "'%s' has no embedded IPv4 address." , toAddrString ( ip ) ) ; }
Examines the Inet6Address to extract the embedded IPv4 client address if the InetAddress is an
IPv6 address of one of the specified address types that contain an embedded IPv4 address.

<p>NOTE: ISATAP addresses are explicitly excluded from this method due to their trivial
spoofability. With other transition addresses spoofing involves (at least) infection of one's
BGP routing table.

@param ip {@link Inet6Address} to be examined for embedded IPv4 client address
@return {@link Inet4Address} of embedded IPv4 client address
@throws IllegalArgumentException if the argument does not have a valid embedded IPv4 address
Examines the Inet6Address to extract the embedded IPv4 client address if the InetAddress is an IPv6 address of one of the specified address types that contain an embedded IPv4 address .