Methods Summary |
---|
static int | bytesToInt(byte[] bytes, int start)
/*
* First mask the byte with 255, as when a negative signed byte converts
* to an integer, it has bits on in the first 3 bytes, we are only
* concerned about the right-most 8 bits. Then shift the rightmost byte
* to align with its position in the integer.
*/
int value = ((bytes[start + 3] & 255)) | ((bytes[start + 2] & 255) << 8)
| ((bytes[start + 1] & 255) << 16) | ((bytes[start] & 255) << 24);
return value;
|
public static java.util.List | getProxyList(java.net.URI uri)Gets proxy list according to the URI by system ProxySelector.
// use system default selector to get proxy list
ProxySelector selector = ProxySelector.getDefault();
if (null == selector) {
return null;
}
return selector.select(uri);
|
static void | intToBytes(int value, byte[] bytes, int start)
/*
* Shift the int so the current byte is right-most Use a byte mask of
* 255 to single out the last byte.
*/
bytes[start] = (byte) ((value >> 24) & 255);
bytes[start + 1] = (byte) ((value >> 16) & 255);
bytes[start + 2] = (byte) ((value >> 8) & 255);
bytes[start + 3] = (byte) (value & 255);
|
public static boolean | preferIPv4Stack()Answer whether to prefer IPV4 stack
final Action a = new Action("java.net.preferIPv4Stack");//$NON-NLS-1$
return AccessController.doPrivileged(a).booleanValue();
|
public static boolean | preferIPv6Addresses()Answer whether to prefer IPV6 address
final Action a = new Action("java.net.preferIPv6Addresses");//$NON-NLS-1$
return AccessController.doPrivileged(a).booleanValue();
|
public static boolean | usingSocks(java.net.Proxy proxy)Returns whether to use a SOCKS proxy.
if (null != proxy && Proxy.Type.SOCKS == proxy.type()) {
return true;
}
return false;
|