Fix DefaultHttpDataSource read when requested length is 0
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=134063990
This commit is contained in:
parent
669cf6804a
commit
654d914bb6
@ -547,11 +547,8 @@ public class DefaultHttpDataSource implements HttpDataSource {
|
|||||||
* @throws IOException If an error occurs reading from the source.
|
* @throws IOException If an error occurs reading from the source.
|
||||||
*/
|
*/
|
||||||
private int readInternal(byte[] buffer, int offset, int readLength) throws IOException {
|
private int readInternal(byte[] buffer, int offset, int readLength) throws IOException {
|
||||||
readLength = bytesToRead == C.LENGTH_UNSET ? readLength
|
|
||||||
: (int) Math.min(readLength, bytesToRead - bytesRead);
|
|
||||||
if (readLength == 0) {
|
if (readLength == 0) {
|
||||||
// We've read all of the requested data.
|
return 0;
|
||||||
return C.RESULT_END_OF_INPUT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int read = inputStream.read(buffer, offset, readLength);
|
int read = inputStream.read(buffer, offset, readLength);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user