6587699: Document DigestInputStream behavior when skip() or mark() / reset() is used

Reviewed-by: wetmore
This commit is contained in:
Weijun Wang 2022-08-18 22:35:13 +00:00
parent a1df2da668
commit 54ce11431d
2 changed files with 76 additions and 0 deletions

View file

@ -51,6 +51,16 @@ import java.io.InputStream;
* retain a handle onto the digest object, and clone it for each
* digest to be computed, leaving the original digest untouched.
*
* @implNote This implementation only updates the message digest
* with data actually read from the input stream when it is
* {@linkplain #on(boolean) turned on}. This includes the various
* {@code read} methods, {@code transferTo}, {@code readAllBytes},
* and {@code readNBytes}. Please note that data bypassed by the
* {@code skip} method are ignored. On the other hand,
* if the underlying stream supports the {@code mark} and
* {@code reset} methods, and the same data is read again after
* {@code reset}, then the message digest is updated again.
*
* @see MessageDigest
*
* @see DigestOutputStream