Fix issue with new extractor input

This commit is contained in:
Oliver Woodman 2015-03-17 12:36:46 +00:00
parent 5e4a35fa7e
commit e54d07c1b0

View File

@ -82,15 +82,15 @@ public final class DataSourceExtractorInput implements ExtractorInput {
if (Thread.interrupted()) { if (Thread.interrupted()) {
throw new InterruptedException(); throw new InterruptedException();
} }
int bytesRead = dataSource.read(SCRATCH_SPACE, 0, remaining); int bytesRead = dataSource.read(SCRATCH_SPACE, 0, Math.min(SCRATCH_SPACE.length, remaining));
if (bytesRead == -1) { if (bytesRead == -1) {
isEnded = true; isEnded = true;
return true; return false;
} }
remaining -= bytesRead; remaining -= bytesRead;
} }
position += length; position += length;
return false; return true;
} }
@Override @Override