Enum NetStat.BusyPort.IPVersion

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      IPV4  
      IPV6  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int addressBytes  
      private java.util.List<java.lang.String> versionIds  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private IPVersion​(java.lang.Class<? extends java.net.InetAddress> addressClass, int addressBytes, java.lang.String... versionIds)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] anyLocal()
      Gets the byte-array form of "any local address" for this IPVersion.
      static NetStat.BusyPort.IPVersion fromId​(java.lang.String versionId)
      Determines the IPVersion from the identifier provided.
      java.net.InetSocketAddress getInetSocketAddress​(java.lang.String address, java.lang.String port)
      Gets an InetSocketAddress instance composed of the IP address and port provided.
      abstract byte[] loopback()
      Gets the byte-array form of the "loopback address" for this IPVersion.
      abstract java.net.InetAddress unspecified()
      Returns an InetAddress instance indicating an "unspecified" (or failed) host address.
      static NetStat.BusyPort.IPVersion valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static NetStat.BusyPort.IPVersion[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • addressBytes

        private final int addressBytes
      • versionIds

        private final java.util.List<java.lang.String> versionIds
    • Constructor Detail

      • IPVersion

        private IPVersion​(java.lang.Class<? extends java.net.InetAddress> addressClass,
                          int addressBytes,
                          java.lang.String... versionIds)
    • Method Detail

      • values

        public static NetStat.BusyPort.IPVersion[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (NetStat.BusyPort.IPVersion c : NetStat.BusyPort.IPVersion.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static NetStat.BusyPort.IPVersion valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • anyLocal

        public byte[] anyLocal()
        Gets the byte-array form of "any local address" for this IPVersion.
        Returns:
        a byte array for "any local address"
      • loopback

        public abstract byte[] loopback()
        Gets the byte-array form of the "loopback address" for this IPVersion.
        Returns:
        a byte array for "loopback address
      • unspecified

        public abstract java.net.InetAddress unspecified()
        Returns an InetAddress instance indicating an "unspecified" (or failed) host address.
        Returns:
        an "unspecified" address
      • getInetSocketAddress

        public java.net.InetSocketAddress getInetSocketAddress​(java.lang.String address,
                                                               java.lang.String port)
        Gets an InetSocketAddress instance composed of the IP address and port provided.
        Parameters:
        address - the IP address conforming to this IPVersion; a value of * is interpreted as the "any local" address
        port - the socket port; a value of * is interpreted as 0 (undesignated)
        Returns:
        an InetSocketAddress instance for address and port; the InetSocketAddress returned may not be of the type implied by this IPVersion instance -- lsof does not maintain strict type alignment for IP addresses
      • fromId

        public static NetStat.BusyPort.IPVersion fromId​(java.lang.String versionId)
        Determines the IPVersion from the identifier provided.
        Parameters:
        versionId - the identifier to check
        Returns:
        the IPVersion corresponding to versionId
        Throws:
        java.lang.EnumConstantNotPresentException - if versionId is not a recognized IPVersion designation