Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8296223

Improve specification of InflaterInputStream.fill()

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 20
    • core-libs
    • None
    • behavioral
    • minimal
    • There is no change in behavior, the change to the javadoc clarifies the current behavior
    • Java API
    • JDK

      Summary

      Clarify the InflaterStream::fill javadoc to indicate that an EOFileException may be thrown and that the protected field len is updated by this method.

      Problem

      The current javadoc does not completely specify the current behavior of InflaterInputStream::fill.

      Solution

      Update the javadoc to match the current behavior of this method,

      Specification

      Update the javadoc to:

      diff --git a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java
      index bab3bad55a3..d60b0447066 100644
      --- a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java
      +++ b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java
      @@ -52,7 +52,7 @@ public class InflaterInputStream extends FilterInputStream {
           protected byte[] buf;
      
           /**
      -     * Length of input buffer.
      +     * The total number of bytes read into the input buffer.
            */
           protected int len;
      
      @@ -251,7 +251,13 @@ public class InflaterInputStream extends FilterInputStream {
      
           /**
            * Fills input buffer with more data to decompress.
      +     * @implSpec
      +     * This method will read up to {@link #buf}.length bytes into the input
      +     * buffer, {@link #buf}, starting at element {@code 0}. The {@link #len}
      +     * field will be set to the number of bytes read.
            * @throws    IOException if an I/O error has occurred
      +     * @throws    EOFException if the end of input stream has been reached
      +     *            unexpectedly
            */
           protected void fill() throws IOException {
               ensureOpen();
      %

            lancea Lance Andersen
            simonis Volker Simonis
            Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: