RFR 8139206: Add InputStream readNBytes(int len) (original) (raw)
Brian Burkhalter brian.burkhalter at oracle.com
Wed Jan 17 16:24:19 UTC 2018
- Previous message: RFR 8139206: Add InputStream readNBytes(int len)
- Next message: RFR 8139206: Add InputStream readNBytes(int len)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The proposed change has been modified to replace the two methods
byte[] InputStream.readAllBytes(int) // reads at most ‘len’ bytes byte[] InputStream.readNBytes(int) // reads exactly ‘len’ bytes or throws IOException
with a single method
byte[] InputStream.readNBytes(int) // reads at most ‘len’ bytes
A negative value of ‘len’ will now cause an IllegalArgumentException instead of an IndexOutOfBoundsException. Also some verbiage has been improved.
http://cr.openjdk.java.net/~bpb/8139206/webrev.01/
Thanks,
Brian
On Jan 16, 2018, at 11:17 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
https://bugs.openjdk.java.net/browse/JDK-8139206 http://cr.openjdk.java.net/~bpb/8139206/webrev.00/
This change would add a new method “byte[] InputStream.readNBytes(int len)” which would read up to at most ‘len’ bytes from the stream and return them in an internally allocated array.
- Previous message: RFR 8139206: Add InputStream readNBytes(int len)
- Next message: RFR 8139206: Add InputStream readNBytes(int len)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]