Fix bug in InputStream.read implementation

This commit is contained in:
konsoletyper 2015-03-10 20:39:28 +03:00
parent 7f33f64d25
commit 5c189cfe15

View File

@ -36,7 +36,7 @@ public abstract class TInputStream extends TObject implements TCloseable {
for (int i = 0; i < len; ++i) { for (int i = 0; i < len; ++i) {
int bt = read(); int bt = read();
if (bt < 0) { if (bt < 0) {
return i; return i == 0 ? -1 : i;
} }
b[off++] = (byte)bt; b[off++] = (byte)bt;
} }