Class IOUtil
- java.lang.Object
-
- org.jenkinsci.test.acceptance.utils.IOUtil
-
public class IOUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description IOUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static File
firstExisting(boolean directory, String... candidatePaths)
Get First existing file or directory.static boolean
isTcpPortFree(int port)
static String
multiline(String... lines)
static HttpURLConnection
openConnection(URL url)
Open URL connection with sanity timeout.static int
randomTcpPort()
Gives random available TCP port.static int
randomTcpPort(int from, int to)
Gives random available TCP port in the given range.
-
-
-
Method Detail
-
firstExisting
@NonNull public static File firstExisting(boolean directory, String... candidatePaths) throws IOException
Get First existing file or directory.- Parameters:
directory
- true if looking for file.- Returns:
- File representing the file or directory.
- Throws:
IOException
- If nothing found.
-
openConnection
public static HttpURLConnection openConnection(@NonNull URL url) throws IOException
Open URL connection with sanity timeout.- Throws:
IOException
-
randomTcpPort
public static int randomTcpPort(int from, int to)
Gives random available TCP port in the given range.- Parameters:
from
- if<=0
then default value 49152 is usedto
- if<=0
then default value 65535 is used
-
randomTcpPort
public static int randomTcpPort()
Gives random available TCP port.
-
isTcpPortFree
public static boolean isTcpPortFree(int port)
-
-