Class Localhost

java.lang.Object
patterntesting.runtime.net.Localhost

public final class Localhost extends Object
This (static) class represents your local host. You can ask it for the local address and other things.
Since:
1.0 (30.01.2010)
Author:
oliver
  • Method Details

    • getInetAddresses

      public static Collection<InetAddress> getInetAddresses()
      Returns all local IP addresses. If you want to get the local host name use InetAddress.getLocalHost().
      Returns:
      a list of the host addresses
    • matches

      public static boolean matches(String... hosts)
      Here we try to get all network addresses to compare it against the given hosts. The host can be given as hostname (e.g. "localhost") or as IP address (e.g. "127.0.0.1").
      Parameters:
      hosts - an array of hosts
      Returns:
      true if matches one of the given hosts.
    • matches

      public static boolean matches(long timeout, TimeUnit unit, String... hosts)
      Here we try to get all network addresses to compare it against the given hosts in a given time. The host can be given as hostname (e.g. "localhost") or as IP address (e.g. "127.0.0.1").
      Parameters:
      timeout - – the maximum time to wait
      unit - – the time unit of the timeout argument
      hosts - - an array of hosts
      Returns:
      true if matches one of the given hosts
      Since:
      2.3
    • matches

      public static boolean matches(String host)
      Here we try to get all network addresses to compare it against the given hosts.
      Parameters:
      host - either IP address (e.g. "127.0.0.1") or hostname (e.g. "localhost")
      Returns:
      true if matches the given host