8206447: InflaterInputStream.skip receives long but it's limited to Integer.MAX_VALUE

Reviewed-by: lancea, alanb
This commit is contained in:
Jaikiran Pai 2024-06-05 15:55:20 +00:00
parent 7acfba288f
commit d7d1afb0a8
2 changed files with 19 additions and 10 deletions

View File

@ -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. <em>Note:</em> 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
* @throws IllegalArgumentException if {@code n < 0}
*/
public long skip(long n) throws IOException {
if (n < 0) {

View File

@ -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 {