jdk/src/share/classes/sun/nio/ch/Net.java
changeset 11823 ee83ae88512d
parent 9679 d98ae8bc45fc
child 14025 fbebe005a3ee
equal deleted inserted replaced
11689:ffbfda5c3886 11823:ee83ae88512d
    31 import java.util.*;
    31 import java.util.*;
    32 import java.security.AccessController;
    32 import java.security.AccessController;
    33 import java.security.PrivilegedAction;
    33 import java.security.PrivilegedAction;
    34 
    34 
    35 
    35 
    36 class Net {                                             // package-private
    36 public class Net {
    37 
    37 
    38     private Net() { }
    38     private Net() { }
    39 
    39 
    40     // unspecified protocol family
    40     // unspecified protocol family
    41     static final ProtocolFamily UNSPEC = new ProtocolFamily() {
    41     static final ProtocolFamily UNSPEC = new ProtocolFamily() {
    73      */
    73      */
    74     static boolean canJoin6WithIPv4Group() {
    74     static boolean canJoin6WithIPv4Group() {
    75         return canJoin6WithIPv4Group0();
    75         return canJoin6WithIPv4Group0();
    76     }
    76     }
    77 
    77 
    78     static InetSocketAddress checkAddress(SocketAddress sa) {
    78     public static InetSocketAddress checkAddress(SocketAddress sa) {
    79         if (sa == null)
    79         if (sa == null)
    80             throw new NullPointerException();
    80             throw new NullPointerException();
    81         if (!(sa instanceof InetSocketAddress))
    81         if (!(sa instanceof InetSocketAddress))
    82             throw new UnsupportedAddressTypeException(); // ## needs arg
    82             throw new UnsupportedAddressTypeException(); // ## needs arg
    83         InetSocketAddress isa = (InetSocketAddress)sa;
    83         InetSocketAddress isa = (InetSocketAddress)sa;
   328     }
   328     }
   329 
   329 
   330     // Due to oddities SO_REUSEADDR on windows reuse is ignored
   330     // Due to oddities SO_REUSEADDR on windows reuse is ignored
   331     private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse);
   331     private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse);
   332 
   332 
   333     static void bind(FileDescriptor fd, InetAddress addr, int port)
   333     public static void bind(FileDescriptor fd, InetAddress addr, int port)
   334         throws IOException
   334         throws IOException
   335     {
   335     {
   336         bind(UNSPEC, fd, addr, port);
   336         bind(UNSPEC, fd, addr, port);
   337     }
   337     }
   338 
   338 
   381         throws IOException;
   381         throws IOException;
   382 
   382 
   383     private static native InetAddress localInetAddress(FileDescriptor fd)
   383     private static native InetAddress localInetAddress(FileDescriptor fd)
   384         throws IOException;
   384         throws IOException;
   385 
   385 
   386     static InetSocketAddress localAddress(FileDescriptor fd)
   386     public static InetSocketAddress localAddress(FileDescriptor fd)
   387         throws IOException
   387         throws IOException
   388     {
   388     {
   389         return new InetSocketAddress(localInetAddress(fd), localPort(fd));
   389         return new InetSocketAddress(localInetAddress(fd), localPort(fd));
   390     }
   390     }
   391 
   391