return buf.limit();
}
private ByteBuffer encodeAsBuffer()
{
BBEncoder encoder = new BBEncoder(ENCODER_SIZE);
encoder.writeInt64(_arrivalTime);
encoder.writeInt32(_bodySize);
int headersLength = 0;
if(_header.getDeliveryProperties() != null)
{
headersLength++;
}
if(_header.getMessageProperties() != null)
{
headersLength++;
}
if(_header.getNonStandardProperties() != null)
{
headersLength += _header.getNonStandardProperties().size();
}
encoder.writeInt32(headersLength);
if(_header.getDeliveryProperties() != null)
{
encoder.writeStruct32(_header.getDeliveryProperties());
}
if(_header.getMessageProperties() != null)
{
encoder.writeStruct32(_header.getMessageProperties());
}
if(_header.getNonStandardProperties() != null)
{
for(Struct header : _header.getNonStandardProperties())
{
encoder.writeStruct32(header);
}
}
ByteBuffer buf = encoder.buffer();
return buf;
}