RFR [9] Add blocking bulk read to java.io.InputStream

Remi Forax forax at univ-mlv.fr
Thu Apr 23 20:22:10 UTC 2015

On 04/23/2015 04:41 PM, Alan Bateman wrote:
> On 23/04/2015 13:22, Remi Forax wrote:
>> I think the name readBytes is not very informative and the name is 
>> too close to read + an array of bytes,
>> we can not use readFully (from DataInput/DataInputStream) because 
>> instead of returning the number of bytes read, it throws a 
>> EOFException if the end of the stream is reached.
>> so what about readAllBytes ?
>> (There is also a readAllBytes in java.nio.file.Files that has an 
>> equivalent semantics).
> For pure convenience then a readAllBytes() that returns a byte[] would 
> be useful. It avoids all the issues around short reads too, and of 
> course easy to specify that the input stream would be left in an 
> inconsistent state if there are any exceptions thrown.

you mean readAllBytes on Files or readAllBytes on InputStream ?

> -Alan


More information about the core-libs-dev mailing list