android - Java Does InputSream.read(byte[] b, int offset, int length) wait for the full amount of bytes specified -
if do, instream.read(buffer, 0, 65); java wait 65 bytes or wait amount of time fill buffer how many ever can.
inputstream.read(byte[] b, int off, int len)
read bytes given byte[]
, len
, , return number of bytes read or -1
if end of stream encountered. must attempt read @ least 1 byte (blocking unless does) unless end of stream encountered, 0
given argument len
parameter, or exception thrown.
whether or not call blocks until len
bytes read implementation detail, in particular default implementation provided in java.io.inputstream
block until len
bytes read, end of stream encountered, or exception thrown, implementations can eagerly return available bytes (as long there least 1 byte read) , still satisfy method's contract.
to summarize, should check return value see how many bytes read off stream.
Comments
Post a Comment