Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net
Class InetAddressHelper

`java.lang.Object
com.tangosol.util.Base
com.tangosol.net.InetAddressHelper`

      public abstract class InetAddressHelper

extends Base

Helper class that encapsulates common InetAddress functionality.

Field Summary
`static boolean` | `PreferIPv4Stack` The value of system property "java.net.preferIPv4Stack".
`static boolean` | `PreferIPv6Addresses` The value of system property "java.net.preferIPv6Addresses".

Constructor Summary
`InetAddressHelper()`

Method Summary
`static List` | `getAllLocalAddresses()` Return a list of all InetAddress objects bound to all the network interfaces on this machine.
`static InetAddress` | `getByAddress(byte[] abAddr)` Return an InetAddress object given the raw IP address.
`static InetAddress` | `getLocalHost()` Obtain the local host address.
`static boolean` | `isAnyLocalAddress(InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isAnyLocalAddress()`
`static boolean` | `isLinkLocalAddress(InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isLinkLocalAddress()`
`static boolean` | `isLoopbackAddress(InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isLoopbackAddress()`
`static boolean` | `isSiteLocalAddress(InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isSiteLocalAddress()`
`static long` | `toLong(InetAddress addr)` Converts an IPv4 compatible address to a long value.
`static String` | `toString(byte[] ab)` Converts a byte array to a raw IP address string representation.
`static String` | `toString(InetAddress addr)` Format an IP address string representing the specified InetAddress object.
`static boolean` | `virtuallyEqual(byte[] abAddr1, byte[] abAddr2)` Compare specified raw IP addresses taking into account IPv4-compatible IPv6 addresses.

Field Detail

### PreferIPv4Stack

    public static final boolean PreferIPv4Stack

  The value of system property "java.net.preferIPv4Stack".
  See Also:
    Networking IPv6 User Guide

### PreferIPv6Addresses

    public static final boolean PreferIPv6Addresses

  The value of system property "java.net.preferIPv6Addresses".
  See Also:
    Networking IPv6 User Guide

Constructor Detail

### InetAddressHelper

    public InetAddressHelper()

Method Detail

### getLocalHost

    public static InetAddress getLocalHost()
                                    throws UnknownHostException

  Obtain the local host address. If at all possible, ensure that the returned address is not a loopback, wildcard or a link local address.
  Returns:
    the InetAddress that is the best fit for the local host address
  Throws:
    `UnknownHostException`
  See Also:
    Sun's Bug Parade

### getAllLocalAddresses

    public static List getAllLocalAddresses()

  Return a list of all InetAddress objects bound to all the network interfaces on this machine.
  Returns:
    a list of InetAddress objects

### isLoopbackAddress

    public static boolean isLoopbackAddress(InetAddress addr)

  Deprecated. As of Coherence 3.0, replaced by `InetAddress.isLoopbackAddress()`
  Check whether or not the specified address is a loopback address.
  Parameters:
    `addr` - the InetAddress
  Returns:
    true iff the address is a loopback address

### isAnyLocalAddress

    public static boolean isAnyLocalAddress(InetAddress addr)

  Deprecated. As of Coherence 3.0, replaced by `InetAddress.isAnyLocalAddress()`
  Check whether or not the specified address is a wildcard address.
  Parameters:
    `addr` - the InetAddress
  Returns:
    true iff the address is a wildcard address

### isLinkLocalAddress

    public static boolean isLinkLocalAddress(InetAddress addr)

  Deprecated. As of Coherence 3.0, replaced by `InetAddress.isLinkLocalAddress()`
  Check whether or not the specified address is a link local address.
  Parameters:
    `addr` - the InetAddress
  Returns:
    true iff the address is a link local address

### isSiteLocalAddress

    public static boolean isSiteLocalAddress(InetAddress addr)

  Deprecated. As of Coherence 3.0, replaced by `InetAddress.isSiteLocalAddress()`
  Check whether or not the specified address is a site local address.
  Parameters:
    `addr` - the InetAddress
  Returns:
    true iff the address is a site local address

### getByAddress

    public static InetAddress getByAddress(byte[] abAddr)
                                    throws UnknownHostException

  Return an InetAddress object given the raw IP address.
  Parameters:
    `abAddr` - the raw IP address in network byte order
  Returns:
    the InetAddress object
  Throws:
    `UnknownHostException`

### virtuallyEqual

    public static boolean virtuallyEqual(byte[] abAddr1,
                                         byte[] abAddr2)

  Compare specified raw IP addresses taking into account IPv4-compatible IPv6 addresses. Two addresses are considered virtually equal if they have the same protocol (length) and are equal, or if one of them is an IPv6 address that is IPv4-compatible and its IPv4 representation is equal to the other IPv4 address.
  Parameters:
    `abAddr1` - first IP address
    `abAddr2` - second IP address
  Returns:
    true iff the addresses are compatible

### toLong

    public static long toLong(InetAddress addr)

  Converts an IPv4 compatible address to a long value.
  Parameters:
    `addr` - an instance of InetAddress to convert to a long
  Returns:
    a long value holding the IPv4 address

### toString

    public static String toString(byte[] ab)

  Converts a byte array to a raw IP address string representation. The format of the address string is one of the following:
  - "d.d.d.d" for IPv4 address
  - "::d.d.d.d" for IPv4 compatible IPv6 address
  - "x:x:x:x:x:x:d.d.d.d" for generic IPv6 address
  Parameters:
    `ab` - the byte array holding the IP address
  Returns:
    the IP address string
  See Also:
    `InetAddress.getHostAddress()`, `Inet6Address`

### toString

    public static String toString(InetAddress addr)

  Format an IP address string representing the specified InetAddress object. The main difference if this method over the `addr.toString()` call is that this implementation avoids a call to the `addr.getHostName()` method, which could be very expensive due to the reverse DNS lookup.
  For IPv6 addresses this method produces an alternative form of "x:x:x:x:x:x:d.d.d.d" and a compressed form of "::d.d.d.d" for IPv4 compatible addresses (instead of the default form "x:x:x:x:x:x:x:x").
  Parameters:
    `addr` - the address for which to format the IP address string
  Returns:
    the IP address string
  See Also:
    `InetAddress.getHostAddress()`, `Inet6Address`

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.