Class Utility


  • public class Utility
    extends Object
    Various useful functions that we wrap in a single class. Some of these functions are needed simply for backwards compatibility with older versions of Java.
    Since:
    JTS 1.0.
    Version:
    $Id: Utility.java 2342 2006-03-30 13:06:17Z $
    Author:
    Mark Little (mark@arjuna.com)
    • Field Detail

      • BACKLOG

        public static final int BACKLOG
        The maximum queue length for incoming connection indications (a request to connect)
        See Also:
        Constant Field Values
      • MAX_PORT

        public static final int MAX_PORT
        Maximum value for a socket port
        See Also:
        Constant Field Values
    • Constructor Detail

      • Utility

        public Utility()
    • Method Detail

      • hostInetAddr

        public static long[] hostInetAddr()
                                   throws UnknownHostException
        Returns:
        Long(s) representing the ip v6 address of the local machine. Essentially the bytes of the InetAddress are shuffled into the long(s). This was once part of the Uid class but has been separated for general availability.
        Throws:
        UnknownHostException
        Since:
        JTS 2.1.
      • hostNameToInetAddress

        public static InetAddress hostNameToInetAddress​(String host)
                                                 throws UnknownHostException
        Convert a host name into an InetAddress object
        Parameters:
        host - if empty or null then the loopback address is used
        Returns:
        an InetAddress structure corresponding the desired host name
        Throws:
        UnknownHostException - if the hostname cannot be found
      • getpid

        public static final int getpid()
        Returns:
        the process id. This had better be unique between processes on the same machine. If not we're in trouble!
        Since:
        JTS 2.1.
      • getProcessUid

        public static Uid getProcessUid()
        Returns:
        a Uid representing this process.
        Since:
        JTS 2.1.
      • isWindows

        public static final boolean isWindows()
      • setProcess

        public static final void setProcess​(Process p)
      • validatePortRange

        public static void validatePortRange​(int port)
      • getDefaultProcessId

        public static String getDefaultProcessId()
      • isAndroid

        public static boolean isAndroid()