diff --git a/src/java.base/share/classes/java/util/zip/DeflaterInputStream.java b/src/java.base/share/classes/java/util/zip/DeflaterInputStream.java index d361af888eb..cb3f534cd5e 100644 --- a/src/java.base/share/classes/java/util/zip/DeflaterInputStream.java +++ b/src/java.base/share/classes/java/util/zip/DeflaterInputStream.java @@ -212,15 +212,17 @@ public class DeflaterInputStream extends FilterInputStream { /** * Skips over and discards data from the input stream. - * This method may block until the specified number of bytes are read and - * skipped. Note: While {@code n} is given as a {@code long}, - * the maximum number of bytes which can be skipped is - * {@code Integer.MAX_VALUE}. + * This method may block until the specified number of bytes are skipped + * or end of stream is reached. * - * @param n number of bytes to be skipped - * @return the actual number of bytes skipped + * @implNote + * This method skips at most {@code Integer.MAX_VALUE} bytes. + * + * @param n number of bytes to be skipped. If {@code n} is zero then no bytes are skipped. + * @return the actual number of bytes skipped, which might be zero * @throws IOException if an I/O error occurs or if this stream is - * already closed + * already closed + * @throws IllegalArgumentException if {@code n < 0} */ public long skip(long n) throws IOException { if (n < 0) { 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 08429aab8aa..f13b5915a84 100644 --- a/src/java.base/share/classes/java/util/zip/InflaterInputStream.java +++ b/src/java.base/share/classes/java/util/zip/InflaterInputStream.java @@ -208,9 +208,16 @@ public class InflaterInputStream extends FilterInputStream { /** * Skips specified number of bytes of uncompressed data. - * @param n the number of bytes to skip - * @return the actual number of bytes skipped. - * @throws IOException if an I/O error has occurred + * This method may block until the specified number of bytes are skipped + * or end of stream is reached. + * + * @implNote + * This method skips at most {@code Integer.MAX_VALUE} bytes. + * + * @param n the number of bytes to skip. If {@code n} is zero then no bytes are skipped. + * @return the actual number of bytes skipped, which might be zero + * @throws IOException if an I/O error occurs or if this stream is + * already closed * @throws IllegalArgumentException if {@code n < 0} */ public long skip(long n) throws IOException {