in activeio-core/src/main/java/org/apache/activeio/packet/AppendedPacket.java [39:57]
static public Packet join(Packet first, Packet last) {
if( first.hasRemaining() ) {
if( last.hasRemaining() ) {
//TODO: this might even be a rejoin of the same continous buffer.
//It would be good if we detected that and avoided just returned the buffer.
return new AppendedPacket(first.slice(), last.slice());
} else {
return first.slice();
}
} else {
if( last.hasRemaining() ) {
return last.slice();
} else {
return EmptyPacket.EMPTY_PACKET;
}
}
}