Class EphemeralPorts


  • public class EphemeralPorts
    extends java.lang.Object
    • Constructor Detail

      • EphemeralPorts

        public EphemeralPorts()
    • Method Detail

      • firstLine

        private static java.lang.String firstLine​(java.lang.String... cmd)
                                           throws java.io.IOException
        Execute a command and return the first response line.
        Parameters:
        cmd - the command to execute
        Returns:
        the first response line
        Throws:
        java.lang.IndexOutOfBoundsException - if the command response is empty
        java.io.IOException - if an error is encountered while executing the command
      • allLines

        private static java.lang.Iterable<java.lang.String> allLines​(java.lang.String... cmd)
                                                              throws java.io.IOException
        Execute a command and return an Iterable with all response lines.
        Parameters:
        cmd - the command to execute
        Returns:
        an Iterable over all response lines
        Throws:
        java.io.IOException - if an error is encountered while executing the command
      • asProperties

        private static java.util.Properties asProperties​(java.lang.String... cmd)
                                                  throws java.io.IOException
        Execute a command and return a Properties instance composed from the output.
        Parameters:
        cmd - the command to execute
        Returns:
        a new Properties instance
        Throws:
        java.io.IOException - if an error is encountered while executing the command or loading the Properties instance
      • main

        public static void main​(java.lang.String[] args)