deal with edge case
@@ -64,6 +64,9 @@ public synchronized int read(ByteBuffer dst) throws IOException {
if (!isOpen()) {
throw new ClosedChannelException();
}
+ if (!dst.hasRemaining()) {
+ return 0;
+ }
int totalBytesRead = 0;
while (dst.hasRemaining() && currentChannelIdx < channels.size()) {
