public int encodedLength()
    {
        int length = 0;

        for (final Type t : containedTypeByNameMap.values())
        {
            if (t.isVariableLength())
            {
                return Token.VARIABLE_LENGTH;
            }

            if (t.offsetAttribute() != -1)
            {
                length = t.offsetAttribute();
            }

            if (t.presence() != Presence.CONSTANT)
            {
                length += t.encodedLength();
            }
        }

        return length;
    }
The encodedLength (in octets) of the list of encoded types.

@return encodedLength of the compositeType.
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java