jdk/src/share/classes/sun/nio/ch/Net.java
changeset 2057 3acf8e5e2ca0
parent 1247 b4c26443dee5
child 5180 8161f879d704
equal deleted inserted replaced
2056:115e09b7a004 2057:3acf8e5e2ca0
     1 /*
     1 /*
     2  * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     7  * published by the Free Software Foundation.  Sun designates this
   205     }
   205     }
   206 
   206 
   207     // -- Socket options
   207     // -- Socket options
   208 
   208 
   209     static void setSocketOption(FileDescriptor fd, ProtocolFamily family,
   209     static void setSocketOption(FileDescriptor fd, ProtocolFamily family,
   210                                 SocketOption name, Object value)
   210                                 SocketOption<?> name, Object value)
   211         throws IOException
   211         throws IOException
   212     {
   212     {
   213         if (value == null)
   213         if (value == null)
   214             throw new IllegalArgumentException("Invalid option value");
   214             throw new IllegalArgumentException("Invalid option value");
   215 
   215 
   260         boolean mayNeedConversion = (family == UNSPEC);
   260         boolean mayNeedConversion = (family == UNSPEC);
   261         setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg);
   261         setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg);
   262     }
   262     }
   263 
   263 
   264     static Object getSocketOption(FileDescriptor fd, ProtocolFamily family,
   264     static Object getSocketOption(FileDescriptor fd, ProtocolFamily family,
   265                                   SocketOption name)
   265                                   SocketOption<?> name)
   266         throws IOException
   266         throws IOException
   267     {
   267     {
   268         Class<?> type = name.type();
   268         Class<?> type = name.type();
   269 
   269 
   270         // only simple values supported by this method
   270         // only simple values supported by this method