List of utility methods to do InetAddress Create
InetAddress | getInetAddress(final int[] octets, final int offset, final int length) getInetAddress final byte[] addressBytes = new byte[length]; for (int i = 0; i < addressBytes.length; i++) { addressBytes[i] = Integer.valueOf(octets[i + offset]).byteValue(); return getInetAddress(addressBytes); |
InetAddress | getInetAddress(final String addressOrName) get Inet Address if (isIPAddress(addressOrName)) { return getInetAddress(addressOrName); } else { return getInetAddressByName(addressOrName); |
InetAddress | getInetAddress(long ip) get Inet Address synchronized (ipWorkBytes) { byte[] ipBytes = ipWorkBytes; long ipAdd = ip; ipBytes[0] = (byte) (ipAdd >> 24); ipBytes[1] = (byte) (ipAdd >> 16); ipBytes[2] = (byte) (ipAdd >> 8); ipBytes[3] = (byte) (ipAdd); try { ... |
String | getInetAddress(Socket socket) get Inet Address String inetAddress = socket == null || socket.getInetAddress() == null ? "" : socket.getInetAddress().toString() + ":" + socket.getPort(); if (inetAddress.startsWith("/")) { inetAddress = inetAddress.substring(1); return inetAddress; |
InetAddress | getInetAddress(String dottedNotation) get Inet Address try { return InetAddress.getByName(dottedNotation); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid IPAddress " + dottedNotation); |
long | getInetAddress(String host) Computes a long value for the given hostname (or dot notated IP address). java.net.InetAddress inaddr; try { if (host == null) { inaddr = java.net.InetAddress.getLocalHost(); } else { inaddr = java.net.InetAddress.getByName(host); } catch (java.net.UnknownHostException une) { ... |
InetAddress | getInetAddress(String hostName) Gets the Inet address for the graylog2ServerHost and gives a specialised error message if an exception is thrown 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'"); |
InetAddress | getInetAddress(String name) Get an InetAddress by name returning null if there is an error resolving the name. try { return InetAddress.getByName(name); } catch (Exception ex) { return null; |
InetAddress | getInetAddress(String str) get Inet Address byte addr[]; addr = getNumericAddress4(str); if (addr == null) addr = getNumericAddress6(str); if (addr == null) return null; try { return InetAddress.getByAddress(new String(), addr); ... |
InetAddress | getInetAddressByName(String name) get Inet Address By Name try { return InetAddress.getByName(name); } catch (Exception ex) { throw new RuntimeException(ex); |