header.setTtl(oldHeader.getTtl());
}
header.setDeliveryCount(UnsignedInteger.valueOf(queueEntry.getDeliveryCount()));
_sectionEncoder.reset();
_sectionEncoder.encodeObject(header);
Binary encodedHeader = _sectionEncoder.getEncoding();
ByteBuffer oldPayload = payload;
payload = ByteBuffer.allocate(oldPayload.remaining() + encodedHeader.getLength());
payload.put(encodedHeader.getArray(),encodedHeader.getArrayOffset(),encodedHeader.getLength());
payload.put(oldPayload);
payload.flip();
}
transfer.setPayload(payload);
byte[] data = new byte[8];
ByteBuffer.wrap(data).putLong(_deliveryTag++);
final Binary tag = new Binary(data);
transfer.setDeliveryTag(tag);
synchronized(_link.getLock())
{