mirror of https://github.com/apache/activemq.git
implement toByteSequence on direct byte buffers too.. needed for http://issues.apache.org/activemq/browse/AMQ-907
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@439108 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9d4c74fb74
commit
1c0de6bda4
|
@ -222,9 +222,13 @@ final public class ByteBufferPacket implements Packet {
|
|||
if( buffer.hasArray() ) {
|
||||
byte[] bs = buffer.array();
|
||||
return new ByteSequence(bs, buffer.position(), buffer.remaining());
|
||||
} else {
|
||||
byte[] bs = new byte[buffer.remaining()];
|
||||
int p = buffer.position();
|
||||
buffer.get(bs);
|
||||
buffer.position(p);
|
||||
return new ByteSequence(bs, 0, bs.length);
|
||||
}
|
||||
// TODO: implement the direct case.
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue