public class NetUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canConnectToRemoteSocket(java.lang.String host,
int port) |
static boolean |
canConnectToSocket(java.lang.String host,
int port) |
static int |
copyStreamContent(ProgressIndicator indicator,
java.io.InputStream inputStream,
java.io.OutputStream outputStream,
int expectedContentLength) |
static int |
findAvailableSocketPort() |
static int[] |
findAvailableSocketPorts(int capacity) |
static java.lang.String |
getLocalHostString() |
static java.net.InetAddress |
getLoopbackAddress()
Deprecated.
use
InetAddress.getLoopbackAddress() |
static boolean |
isLocalhost(java.lang.String hostName) |
static boolean |
isSniEnabled() |
static int |
tryToFindAvailableSocketPort() |
static int |
tryToFindAvailableSocketPort(int defaultPort) |
public static boolean canConnectToSocket(java.lang.String host, int port)
@Deprecated public static java.net.InetAddress getLoopbackAddress()
InetAddress.getLoopbackAddress()
public static boolean isLocalhost(java.lang.String hostName)
public static boolean canConnectToRemoteSocket(java.lang.String host, int port)
public static int findAvailableSocketPort() throws java.io.IOException
java.io.IOException
public static int tryToFindAvailableSocketPort(int defaultPort)
public static int tryToFindAvailableSocketPort()
public static int[] findAvailableSocketPorts(int capacity) throws java.io.IOException
java.io.IOException
public static java.lang.String getLocalHostString()
public static int copyStreamContent(ProgressIndicator indicator, java.io.InputStream inputStream, java.io.OutputStream outputStream, int expectedContentLength) throws java.io.IOException, ProcessCanceledException
indicator
- progress indicatorinputStream
- source streamoutputStream
- destination streamexpectedContentLength
- expected content length in bytes, used in progress indicator (negative means unknown length).
For gzipped content, it's an expected length of gzipped/compressed content.
E.g. for HTTP, it means how many bytes should be sent over the network.java.io.IOException
- if IO error occurProcessCanceledException
- if process was canceled.public static boolean isSniEnabled()