jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java
changeset 28852 a581c7868768
parent 27078 39275d6a8cac
child 35302 e4d2275861c3
equal deleted inserted replaced
28851:e4c16ed7bffa 28852:a581c7868768
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2015, Oracle and/or its affiliates. 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.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   265     }
   265     }
   266 
   266 
   267     /**
   267     /**
   268      * Called to set a socket option.
   268      * Called to set a socket option.
   269      *
   269      *
       
   270      * @param <T> The type of the socket option value
   270      * @param name The socket option
   271      * @param name The socket option
   271      *
   272      *
   272      * @param value The value of the socket option. A value of {@code null}
   273      * @param value The value of the socket option. A value of {@code null}
   273      *              may be valid for some options.
   274      *              may be valid for some options.
   274      *
   275      *
   275      * @throws UnsupportedOperationException if the DatagramSocketImpl does not
   276      * @throws UnsupportedOperationException if the DatagramSocketImpl does not
   276      *         support the option
   277      *         support the option
   277      *
   278      *
   278      * @throws NullPointerException if name is {@code null}
   279      * @throws NullPointerException if name is {@code null}
   279      *
   280      * @throws IOException if an I/O problem occurs while attempting to set the option
   280      * @since 1.9
   281      * @since 1.9
   281      */
   282      */
   282     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
   283     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
   283         if (name == StandardSocketOptions.SO_SNDBUF) {
   284         if (name == StandardSocketOptions.SO_SNDBUF) {
   284             setOption(SocketOptions.SO_SNDBUF, value);
   285             setOption(SocketOptions.SO_SNDBUF, value);
   306     }
   307     }
   307 
   308 
   308     /**
   309     /**
   309      * Called to get a socket option.
   310      * Called to get a socket option.
   310      *
   311      *
       
   312      * @return the socket option
       
   313      * @param <T> The type of the socket option value
   311      * @param name The socket option
   314      * @param name The socket option
   312      *
   315      *
   313      * @throws UnsupportedOperationException if the DatagramSocketImpl does not
   316      * @throws UnsupportedOperationException if the DatagramSocketImpl does not
   314      *         support the option
   317      *         support the option
   315      *
   318      *
   316      * @throws NullPointerException if name is {@code null}
   319      * @throws NullPointerException if name is {@code null}
       
   320      * @throws IOException if an I/O problem occurs while attempting to set the option
   317      *
   321      *
   318      * @since 1.9
   322      * @since 1.9
   319      */
   323      */
   320     @SuppressWarnings("unchecked")
   324     @SuppressWarnings("unchecked")
   321     protected <T> T getOption(SocketOption<T> name) throws IOException {
   325     protected <T> T getOption(SocketOption<T> name) throws IOException {