Skip to content

Commit

Permalink
8206447: InflaterInputStream.skip receives long but it's limited to I…
Browse files Browse the repository at this point in the history
…nteger.MAX_VALUE

Reviewed-by: lancea, alanb
  • Loading branch information
jaikiran committed Jun 5, 2024
1 parent 7acfba2 commit d7d1afb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,17 @@ public int read(byte[] b, int off, int len) throws IOException {

/**
* 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
* already closed
* @throws IllegalArgumentException if {@code n < 0}
*/
public long skip(long n) throws IOException {
if (n < 0) {
Expand Down
13 changes: 10 additions & 3 deletions src/java.base/share/classes/java/util/zip/InflaterInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,16 @@ public int available() throws IOException {

/**
* 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 {
Expand Down

1 comment on commit d7d1afb

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.