niosocketimpl-branch: minor cleanup niosocketimpl-branch
authorchegar
Thu, 28 Feb 2019 11:08:30 +0000
branchniosocketimpl-branch
changeset 57225 debeede2898e
parent 57224 1b773b0aa5f6
child 57226 4d57d18f0ca5
niosocketimpl-branch: minor cleanup
src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java
--- a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java	Thu Feb 28 10:47:50 2019 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java	Thu Feb 28 11:08:30 2019 +0000
@@ -233,7 +233,7 @@
     }
 
     /**
-     * Try to read bytes from the socket into the given byte array.
+     * Tries to read bytes from the socket into the given byte array.
      */
     private int tryRead(FileDescriptor fd, byte[] b, int off, int len)
         throws IOException
@@ -374,7 +374,8 @@
     }
 
     /**
-     * Try to write a sequence of bytes to this socket from the given byte array
+     * Tries to write a sequence of bytes to this socket from the given
+     * byte array.
      */
     private int tryWrite(FileDescriptor fd, byte[] b, int off, int len)
         throws IOException
@@ -589,7 +590,7 @@
     }
 
     /**
-     * Waits for a connection attempt to finish with a timeout
+     * Waits for a connection attempt to finish with a timeout.
      * @throws SocketTimeoutException if the connect timeout elapses
      */
     private int timedFinishConnect(FileDescriptor fd, int millis) throws IOException {
@@ -611,7 +612,7 @@
     }
 
     /**
-     * Connect the socket. Closes the socket if connection cannot be established.
+     * Connects the socket. Closes the socket if connection cannot be established.
      * @throws IllegalArgumentException if the address is not an InetSocketAddress
      * @throws UnknownHostException if the InetSocketAddress is not resolved
      * @throws IOException if the connection cannot be established
@@ -686,8 +687,8 @@
                 throw new SocketException("Already bound");
             NetHooks.beforeTcpBind(fd, host, port);
             Net.bind(fd, host, port);
-            // set the address field to the address specified to the method to
-            // keep compatibility with PlainSocketImpl. When binding to 0.0.0.0
+            // set the address field to the given address, host, to keep
+            // compatibility with PlainSocketImpl. When binding to 0.0.0.0
             // then the actual local address will be ::0 when IPv6 is enabled.
             address = host;
             localport = Net.localAddress(fd).getPort();
@@ -736,7 +737,7 @@
     }
 
     /**
-     * Accepts a new connection with a timeout
+     * Accepts a new connection with a timeout.
      * @throws SocketTimeoutException if the accept timeout elapses
      */
     private int timedAccept(FileDescriptor fd,
@@ -1270,7 +1271,7 @@
     }
 
     /**
-     * Returns the socket protocol family
+     * Returns the socket protocol family.
      */
     private static ProtocolFamily family() {
         if (Net.isIPv6Available()) {
@@ -1281,7 +1282,7 @@
     }
 
     /**
-     * Returns the native file descriptor
+     * Returns the native file descriptor.
      */
     private static int fdVal(FileDescriptor fd) {
         int fdVal = SharedSecrets.getJavaIOFileDescriptorAccess().get(fd);