Skip to content
Merged
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 @@ -50,9 +50,10 @@ public class FileRegionEncoder extends MessageToByteEncoder<FileRegion> {
protected void encode(ChannelHandlerContext ctx, FileRegion msg, final ByteBuf out) throws Exception {
WritableByteChannel writableByteChannel = new WritableByteChannel() {
@Override
public int write(ByteBuffer src) throws IOException {
public int write(ByteBuffer src) {
int prev = out.writerIndex();
out.writeBytes(src);
return out.capacity();
return out.writerIndex() - prev;
}

@Override
Expand All @@ -75,4 +76,4 @@ public void close() throws IOException {
msg.transferTo(writableByteChannel, transferred);
}
}
}
}