changeset 49669:63eceefeb347

8182684: Further clarify InputStream#available() Reviewed-by: alanb, rriggs
author bpb
date Tue, 13 Mar 2018 12:24:39 -0700
parents 6e6c3a755b89
children c35ec365e329
files src/java.base/share/classes/java/io/InputStream.java
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/io/InputStream.java	Tue Mar 13 11:49:17 2018 -0700
+++ b/src/java.base/share/classes/java/io/InputStream.java	Tue Mar 13 12:24:39 2018 -0700
@@ -539,29 +539,29 @@
     }
 
     /**
-     * Returns an estimate of the number of bytes that can be read (or
-     * skipped over) from this input stream without blocking by the next
-     * invocation of a method for this input stream. The next invocation
-     * might be the same thread or another thread.  A single read or skip of this
-     * many bytes will not block, but may read or skip fewer bytes.
+     * Returns an estimate of the number of bytes that can be read (or skipped
+     * over) from this input stream without blocking, which may be 0, or 0 when
+     * end of stream is detected.  The read might be on the same thread or
+     * another thread.  A single read or skip of this many bytes will not block,
+     * but may read or skip fewer bytes.
      *
-     * <p> Note that while some implementations of {@code InputStream} will return
-     * the total number of bytes in the stream, many will not.  It is
+     * <p> Note that while some implementations of {@code InputStream} will
+     * return the total number of bytes in the stream, many will not.  It is
      * never correct to use the return value of this method to allocate
      * a buffer intended to hold all data in this stream.
      *
-     * <p> A subclass' implementation of this method may choose to throw an
-     * {@link IOException} if this input stream has been closed by
-     * invoking the {@link #close()} method.
+     * <p> A subclass's implementation of this method may choose to throw an
+     * {@link IOException} if this input stream has been closed by invoking the
+     * {@link #close()} method.
      *
-     * <p> The {@code available} method for class {@code InputStream} always
-     * returns {@code 0}.
+     * <p> The {@code available} method of {@code InputStream} always returns
+     * {@code 0}.
      *
      * <p> This method should be overridden by subclasses.
      *
-     * @return     an estimate of the number of bytes that can be read (or skipped
-     *             over) from this input stream without blocking or {@code 0} when
-     *             it reaches the end of the input stream.
+     * @return     an estimate of the number of bytes that can be read (or
+     *             skipped over) from this input stream without blocking or
+     *             {@code 0} when it reaches the end of the input stream.
      * @exception  IOException if an I/O error occurs.
      */
     public int available() throws IOException {