Class NetworkUtils

java.lang.Object
org.deltava.util.NetworkUtils

public class NetworkUtils extends Object
A utility class to handle TCP/IP network operations.
Since:
1.0
Version:
11.0
Author:
Luke
  • Method Details

    • getType

      public static NetworkUtils.AddressType getType(String addr)
      Returns an IP address type.
      Parameters:
      addr - an IP address
      Returns:
      the AddressType
    • getByName

      public static String getByName(String hostName)
      Exception-safe mechanism to resolve a host name to an IP address.
      Parameters:
      hostName - the host name
      Returns:
      the IP address, or null if unable to resolve
    • format

      public static String format(byte[] addr)
      Formats a packed IP address.
      Parameters:
      addr - the IP address
      Returns:
      the formatted IP address
    • getSourceAddress

      public static String getSourceAddress(SocketAddress sa)
      Returns a address in host:port format.
      Parameters:
      sa - the address
      Returns:
      the address in host:port format