in proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement.java [52:109]
public int size()
{
int count = 0;
int size = 0;
Element elt = _first;
while(elt != null)
{
count++;
size += elt.size();
elt = elt.next();
}
if(isElementOfArray())
{
ArrayElement parent = (ArrayElement) parent();
if(parent.constructorType() == ArrayElement.TINY)
{
if(count != 0)
{
parent.setConstructorType(ArrayElement.ConstructorType.SMALL);
size += 2;
}
}
else if(parent.constructorType() == ArrayElement.SMALL)
{
if(count > 255 || size > 254)
{
parent.setConstructorType(ArrayElement.ConstructorType.LARGE);
size += 8;
}
else
{
size += 2;
}
}
else
{
size += 8;
}
}
else
{
if(count == 0)
{
size = 1;
}
else if(count <= 255 && size <= 254)
{
size += 3;
}
else
{
size+=9;
}
}
return size;
}