Class EphemeralPorts
- java.lang.Object
-
- org.terracotta.utilities.test.net.EphemeralPorts
-
public class EphemeralPorts extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classEphemeralPorts.Aixprivate static classEphemeralPorts.Linuxprivate static classEphemeralPorts.Macstatic classEphemeralPorts.Rangeprivate static interfaceEphemeralPorts.RangeGetterprivate static classEphemeralPorts.SolarisAndHPUXprivate static classEphemeralPorts.Windows
-
Field Summary
Fields Modifier and Type Field Description private static EphemeralPorts.RangeIANA_DEFAULT_RANGEprivate static org.slf4j.LoggerLOGGERprivate static EphemeralPorts.Rangerange
-
Constructor Summary
Constructors Constructor Description EphemeralPorts()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.Iterable<java.lang.String>allLines(java.lang.String... cmd)Execute a command and return anIterablewith all response lines.private static java.util.PropertiesasProperties(java.lang.String... cmd)Execute a command and return aPropertiesinstance composed from the output.private static EphemeralPorts.RangefindRange()private static java.lang.StringfirstLine(java.lang.String... cmd)Execute a command and return the first response line.static EphemeralPorts.RangegetRange()static voidmain(java.lang.String[] args)
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
IANA_DEFAULT_RANGE
private static final EphemeralPorts.Range IANA_DEFAULT_RANGE
-
range
private static EphemeralPorts.Range range
-
-
Method Detail
-
getRange
public static EphemeralPorts.Range getRange()
-
findRange
private static EphemeralPorts.Range findRange()
-
firstLine
private static java.lang.String firstLine(java.lang.String... cmd) throws java.io.IOExceptionExecute 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 emptyjava.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.IOExceptionExecute a command and return anIterablewith all response lines.- Parameters:
cmd- the command to execute- Returns:
- an
Iterableover 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.IOExceptionExecute a command and return aPropertiesinstance composed from the output.- Parameters:
cmd- the command to execute- Returns:
- a new
Propertiesinstance - Throws:
java.io.IOException- if an error is encountered while executing the command or loading thePropertiesinstance
-
main
public static void main(java.lang.String[] args)
-
-