Hello!
An encoding output stream 'es' can be obtained as encoder.wrap(os).
Normally, es.write(buf, off, len) throws IndexOutOfBoundException, if
the referenced portion lies outside of the buffer.
In this case, nothing is written to the underlying output stream 'os'.
However, if (off + len) overflows, then the call to write() will produce
some output, and only when it reaches the boundary of the buf will it
throw the exception.
This behavior looks inconsistent.
Would you please help review the simple fix?
BUGURL: https://bugs.openjdk.java.net/browse/JDK-8165243
WEBREV: http://cr.openjdk.java.net/~igerasim/8165243/00/webrev/
With kind regards,
Ivan