Hi Brian,

Sorry for the delay in looking at this.

InputStream.java:

584:  Is there really a case where line 585 would throw the exception?

   skip(n, true) != n

With the 2nd argument = true, it will either skip the bytes or throw.
I think you can just call:  "skip(n, true);


Given subclasses of InputStream that might override skip(n) with a more efficient mechanism
would it make sense to implement skipNBytes in terms of skip(n)?
As is, it always uses read() to skip the bytes, which might not be as efficient as possible
on some streams (for example a very large file) where a seek could be used.

test/jdk/java/io/InputStream/Skip.java:

There is a lot of whitespace in this test, spaces before "," and extra blank lines.

97: "possible result" - does that occur in the tests?  The "possible" is a bit ambiguous especially given the very narrow test case. It would be useful to include the message from the exception.

Regards, Roger


On 10/01/2018 05:44 PM, Brian Burkhalter wrote:
https://bugs.openjdk.java.net/browse/JDK-6516099
http://cr.openjdk.java.net/~bpb/6516099/webrev.00/

This patch implements a method InputStream.skipNBytes() instead of skipFully() 
based on the supposition that this name is less likely to conflict with 
existing subclasses, e.g., [1]. There is some inconsistency however with 
respect to the description of the method readNBytes() [2], which may return 
fewer than N bytes if end of stream is reached first.

If we converge on a solution in this thread I’ll file a CSR.

Thanks,

Brian

[1] 
https://developer.ibm.com/static/site-id/155/maximodev/7609/maximocore/businessobjects/psdi/iface/webservices/action/bytecode/ClassReader.html
[2] 
https://download.java.net/java/early_access/jdk12/docs/api/java.base/java/io/InputStream.html#readNBytes(byte[],int,int)

Reply via email to