-
Sub-task
-
Resolution: Delivered
-
P4
-
20
-
generic
-
generic
The specification of the `read` methods defined by `java.util.zip.InflaterInputStream`,`ZipInputStream`, and `GZIPInputStream` have changed to allow these methods deviate from `InputStream.read` for the case that a “short read” occurs.
A “short read” is the case where the user provides a buffer with space for M bytes but only N bytes (where 0 < N < M) are read. The long standing specification for `InputStream.read` is that N bytes are stored in the buffer provided by the user and elements at offset off+N to off+M-1 are not changed.
The deviation allows the `read` method to use the elements at off+N to off+M-1 as temporary storage. Code using these APIs can no longer depend on these elements being unaffected when reading uncompressed data into a byte array.
A “short read” is the case where the user provides a buffer with space for M bytes but only N bytes (where 0 < N < M) are read. The long standing specification for `InputStream.read` is that N bytes are stored in the buffer provided by the user and elements at offset off+N to off+M-1 are not changed.
The deviation allows the `read` method to use the elements at off+N to off+M-1 as temporary storage. Code using these APIs can no longer depend on these elements being unaffected when reading uncompressed data into a byte array.