Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,21 @@ static int fillFrom(ByteBuffer buf, ReadableByteChannel c) throws IOException {
return total;
}

static int emptyTo(ByteBuffer buf, WritableByteChannel c) throws IOException {
int total = 0;
while (buf.hasRemaining()) {
int written = c.write(buf);
if (written != -1) {
total += written;
} else if (total == 0) {
return -1;
} else {
break;
}
}
return total;
}

static long totalRemaining(ByteBuffer[] buffers, int offset, int length) {
long totalRemaning = 0;
for (int i = offset; i < length; i++) {
Expand Down
Loading
Loading