< prev index next >
src/java.base/share/classes/sun/nio/ch/Net.java
Print this page
@@ -52,11 +52,11 @@
import sun.net.ext.ExtendedSocketOptions;
import sun.security.action.GetPropertyAction;
public class Net {
- private Net() { }
+ protected Net() { }
// unspecified protocol family
static final ProtocolFamily UNSPEC = new ProtocolFamily() {
public String name() {
return "UNSPEC";
@@ -77,11 +77,11 @@
private static volatile boolean isReusePortAvailable;
/**
* Tells whether dual-IPv4/IPv6 sockets should be used.
*/
- static boolean isIPv6Available() {
+ protected static boolean isIPv6Available() {
if (!checkedIPv6) {
isIPv6Available = isIPv6Available0();
checkedIPv6 = true;
}
return isIPv6Available;
@@ -148,11 +148,11 @@
if (!(sa instanceof InetSocketAddress))
throw new UnsupportedAddressTypeException();
return (InetSocketAddress)sa;
}
- static void translateToSocketException(Exception x)
+ public static void translateToSocketException(Exception x)
throws SocketException
{
if (x instanceof SocketException)
throw (SocketException)x;
Exception nx = x;
@@ -178,11 +178,11 @@
throw (RuntimeException)nx;
else
throw new Error("Untranslated exception", nx);
}
- static void translateException(Exception x,
+ public static void translateException(Exception x,
boolean unknownHostForUnresolved)
throws IOException
{
if (x instanceof IOException)
throw (IOException)x;
@@ -194,20 +194,20 @@
throw new UnknownHostException();
}
translateToSocketException(x);
}
- static void translateException(Exception x)
+ public static void translateException(Exception x)
throws IOException
{
translateException(x, false);
}
/**
* Returns the local address after performing a SecurityManager#checkConnect.
*/
- static InetSocketAddress getRevealedLocalAddress(InetSocketAddress addr) {
+ public static InetSocketAddress getRevealedLocalAddress(InetSocketAddress addr) {
SecurityManager sm = System.getSecurityManager();
if (addr == null || sm == null)
return addr;
try{
@@ -218,11 +218,11 @@
addr = getLoopbackAddress(addr.getPort());
}
return addr;
}
- static String getRevealedLocalAddressAsString(InetSocketAddress addr) {
+ public static String getRevealedLocalAddressAsString(InetSocketAddress addr) {
return System.getSecurityManager() == null ? addr.toString() :
getLoopbackAddress(addr.getPort()).toString();
}
private static InetSocketAddress getLoopbackAddress(int port) {
< prev index next >