Java InetAddress Create getInetAddress(String hostName)

Here you can find the source of getInetAddress(String hostName)

Description

Gets the Inet address for the graylog2ServerHost and gives a specialised error message if an exception is thrown

License

Open Source License

Return

The Inet address for graylog2ServerHost

Declaration

public static InetAddress getInetAddress(String hostName) 

Method Source Code


//package com.java2s;
import java.net.InetAddress;

import java.net.UnknownHostException;

public class Main {
    /**//w ww.  jav a  2s  .  com
     * Gets the Inet address for the graylog2ServerHost and gives a specialised error message if an exception is thrown
     *
     * @return The Inet address for graylog2ServerHost
     */
    public static InetAddress getInetAddress(String hostName) {
        try {
            return InetAddress.getByName(hostName);
        } catch (UnknownHostException e) {
            throw new IllegalStateException("Unknown host: " + e.getMessage()
                    + ". Make sure you have specified the 'graylog2ServerHost' property correctly in your logback.xml'");
        }
    }
}

Related

  1. getInetAddress(final String addressOrName)
  2. getInetAddress(long ip)
  3. getInetAddress(Socket socket)
  4. getInetAddress(String dottedNotation)
  5. getInetAddress(String host)
  6. getInetAddress(String name)
  7. getInetAddress(String str)
  8. getInetAddressByName(String name)
  9. getInetAddresses()