Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-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 java.util.List` | `getAllLocalAddresses()` Return a list of all InetAddress objects bound to all the network interfaces on this machine.
`static java.net.InetAddress` | `getByAddress(byte[] abAddr)` Return an InetAddress object given the raw IP address.
`static java.net.InetAddress` | `getLocalHost()` Obtain the local host address.
`static boolean` | `isAnyLocalAddress(java.net.InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isAnyLocalAddress()`
`static boolean` | `isLinkLocalAddress(java.net.InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isLinkLocalAddress()`
`static boolean` | `isLoopbackAddress(java.net.InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isLoopbackAddress()`
`static boolean` | `isSiteLocalAddress(java.net.InetAddress addr)` Deprecated. As of Coherence 3.0, replaced by `InetAddress.isSiteLocalAddress()`
`static long` | `toLong(java.net.InetAddress addr)` Converts an IPv4 compatible address to a long value.
`static java.lang.String` | `toString(byte[] ab)` Converts a byte array to a raw IP address string representation.
`static java.lang.String` | `toString(java.net.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 java.net.InetAddress getLocalHost()
                                             throws java.net.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:
    `java.net.UnknownHostException`
  See Also:
    Sun's Bug Parade

### getAllLocalAddresses

    public static java.util.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(java.net.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(java.net.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(java.net.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(java.net.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 java.net.InetAddress getByAddress(byte[] abAddr)
                                             throws java.net.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:
    `java.net.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(java.net.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 java.lang.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 java.lang.String toString(java.net.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`

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.