_footer = footer;
}
public int decode(byte[] data, int offset, int length)
{
DecoderImpl decoder = new DecoderImpl();
EncoderImpl encoder = new EncoderImpl(decoder);
AMQPDefinedTypes.registerAllTypes(decoder);
final ByteBuffer buffer = ByteBuffer.wrap(data, offset, length);
decoder.setByteBuffer(buffer);
_header = null;
_deliveryAnnotations = null;
_messageAnnotations = null;
_properties = null;
_applicationProperties = null;
_body = null;
_footer = null;
Section section = null;
if(buffer.hasRemaining())
{
section = (Section) decoder.readObject();
}
if(section instanceof Header)
{
_header = (Header) section;
if(buffer.hasRemaining())
{
section = (Section) decoder.readObject();
}
else
{
section = null;
}
}
if(section instanceof DeliveryAnnotations)
{
_deliveryAnnotations = (DeliveryAnnotations) section;
if(buffer.hasRemaining())
{
section = (Section) decoder.readObject();
}
else
{
section = null;
}
}
if(section instanceof MessageAnnotations)
{
_messageAnnotations = (MessageAnnotations) section;
if(buffer.hasRemaining())
{
section = (Section) decoder.readObject();
}
else
{
section = null;
}
}
if(section instanceof Properties)
{
_properties = (Properties) section;
if(buffer.hasRemaining())
{
section = (Section) decoder.readObject();
}
else
{
section = null;
}
}
if(section instanceof ApplicationProperties)
{
_applicationProperties = (ApplicationProperties) section;
if(buffer.hasRemaining())
{
section = (Section) decoder.readObject();
}
else
{
section = null;
}
}
if(section != null && !(section instanceof Footer))
{
_body = section;
if(buffer.hasRemaining())
{
section = (Section) decoder.readObject();
}
else
{
section = null;
}