@Override
public ContentType encode(Packet packet, OutputStream out) throws IOException {
setRootCodec(packet);
if (packet.getMessage() instanceof MessageDataSource) {
final MessageDataSource mds = (MessageDataSource)packet.getMessage();
if (mds.hasUnconsumedDataSource())
return _adaptingContentType.set(packet, encode(mds, out));
}
return _adaptingContentType.set(packet, super.encode(packet, out));
}