Fixed issue: NETTY-176 ByteBufferBackedBuffer.toByteBuffer() and slice() do not respect byte order
This commit is contained in:
parent
e04d8e9de1
commit
b9cd9de5ed
@ -285,9 +285,10 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
|
|||||||
|
|
||||||
public ByteBuffer toByteBuffer(int index, int length) {
|
public ByteBuffer toByteBuffer(int index, int length) {
|
||||||
if (index == 0 && length == capacity()) {
|
if (index == 0 && length == capacity()) {
|
||||||
return buffer.duplicate();
|
return buffer.duplicate().order(order());
|
||||||
} else {
|
} else {
|
||||||
return ((ByteBuffer) buffer.duplicate().position(index).limit(index + length)).slice();
|
return ((ByteBuffer) buffer.duplicate().position(
|
||||||
|
index).limit(index + length)).slice().order(order());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +320,8 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
|
|||||||
return ChannelBuffers.EMPTY_BUFFER;
|
return ChannelBuffers.EMPTY_BUFFER;
|
||||||
}
|
}
|
||||||
return new ByteBufferBackedChannelBuffer(
|
return new ByteBufferBackedChannelBuffer(
|
||||||
((ByteBuffer) buffer.duplicate().position(index).limit(index + length)));
|
((ByteBuffer) buffer.duplicate().position(
|
||||||
|
index).limit(index + length)).order(order()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user