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

Rémi


Reply via email to