Class NetStat.BusyPort

  • Enclosing class:
    NetStat

    public static class NetStat.BusyPort
    extends java.lang.Object
    Describes an active TCP port and associates it with the controlling process.
    • Field Detail

      • processId

        private final long processId
      • localEndpoint

        private final java.net.InetSocketAddress localEndpoint
      • remoteEndpoint

        private final java.net.InetSocketAddress remoteEndpoint
      • shortCommand

        private final java.lang.String shortCommand
      • commandLine

        private final java.lang.String commandLine
    • Constructor Detail

      • BusyPort

        private BusyPort​(long processId,
                         java.net.InetSocketAddress localEndpoint,
                         java.net.InetSocketAddress remoteEndpoint,
                         NetStat.BusyPort.TcpState state,
                         java.lang.String shortCommand,
                         java.lang.String commandLine)
    • Method Detail

      • processId

        public long processId()
        Gets the process id associated with this connection.
        Returns:
        the process id
      • localEndpoint

        public java.net.InetSocketAddress localEndpoint()
        Gets the local endpoint socket address.
        Returns:
        the local endpoint socket address
      • remoteEndpoint

        public java.net.InetSocketAddress remoteEndpoint()
        Gets the remote endpoint socket address. If localEndpoint() is a listening port, the value returned uses a socket number of zero and an IP address corresponding to a wildcard address.
        Returns:
        the remote endpoint socket address
      • shortCommand

        public java.lang.String shortCommand()
        Gets the short representation of the command as provided by the TCP connection information source.
        Returns:
        the short command string
      • commandLine

        public java.lang.String commandLine()
        Gets the long representation of the command. This value is the full command line if available.
        Returns:
        the long command string; may be null
      • toString

        public java.lang.String toString​(java.lang.String fieldSeparator)
        Produces a print-suitable string of this BusyPort instance. This method displays only one of shortCommand or commandLine -- if commandLine is set, its value is included; otherwise, the shortCommand value is used.
        Parameters:
        fieldSeparator - the field separator to use; if null or empty, a single space is used
        Returns:
        a print-suitable string
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object