Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Only need to use bytes.remaining()
  • Loading branch information
caneGuy committed Aug 24, 2017
commit b6693513441faf350dcdc3636723359561346a17
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private[spark] class ChunkedByteBuffer(var chunks: Array[ByteBuffer]) {
def writeFully(channel: WritableByteChannel): Unit = {
for (bytes <- getChunks()) {
val capacity = bytes.limit()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is not used.

while (bytes.position() < capacity && bytes.remaining() > 0) {
while (bytes.remaining() > 0) {
val ioSize = Math.min(bytes.remaining(), NIO_BUFFER_LIMIT)
bytes.limit(bytes.position + ioSize)
channel.write(bytes)
Expand Down