Throw exception on 0-byte read.

This commit is contained in:
David Renshaw 2020-05-06 17:06:02 -04:00
parent a16a8b517c
commit 0e99996372

View file

@ -42,8 +42,9 @@ public final class Serialize {
int r = bc.read(buffer);
if (r < 0) {
throw new IOException("premature EOF");
} else if (r == 0) {
throw new IOException("Read zero bytes. Is the channel in non-blocking mode?");
}
// TODO check for r == 0 ?.
}
}