Merged bug fix from Stable into Unstable

This commit is contained in:
Matt Hanna 2012-02-01 16:07:41 -05:00
commit 8adfc79123
1 changed files with 10 additions and 1 deletions

View File

@ -443,7 +443,16 @@ public class BlockInputStream extends SeekableStream implements BAMInputStream {
// }
// }
return eof() ? -1 : length-remaining;
// If any data was copied into the buffer, return the amount of data copied.
if(remaining < length)
return length - remaining;
// Otherwise, if at eof(), return -1.
else if(eof())
return -1;
// Otherwise, we must've hit a bug in the system.
throw new ReviewedStingException("BUG: read returned no data, but eof() reports false.");
}
public void close() {