@Override
  public void set(byte[] b, int s, int len) {
    reset();
    super.set(b, s, len);

    int numberOfitems = AInt32SerializerDeserializer.getInt(b, s + 6);
    int itemOffset;
    if (typedItemList) {
      switch (itemTag) {
        case STRING:
        case BINARY:
        case RECORD:
        case ORDEREDLIST:
        case UNORDEREDLIST:
        case ANY:
          itemOffset = s + 10 + (numberOfitems * 4);
          break;
        default:
          itemOffset = s + 10;
      }
    } else {
      itemOffset = s + 10 + (numberOfitems * 4);
    }
    int itemLength = 0;
    try {
      if (typedItemList) {
        for (int i = 0; i < numberOfitems; i++) {
          itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, false);
          IVisitablePointable tag = allocator.allocateEmpty();
          IVisitablePointable item = allocator.allocateFieldValue(itemType);

          // set item type tag
          int start = dataBos.size();
          dataDos.writeByte(itemTag.serialize());
          int end = dataBos.size();
          tag.set(dataBos.getByteArray(), start, end - start);
          itemTags.add(tag);

          // set item value
          start = dataBos.size();
          dataDos.writeByte(itemTag.serialize());
          dataDos.write(b, itemOffset, itemLength);
          end = dataBos.size();
          item.set(dataBos.getByteArray(), start, end - start);
          itemOffset += itemLength;
          items.add(item);
        }
      } else {
        for (int i = 0; i < numberOfitems; i++) {
          itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[itemOffset]);
          itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, true) + 1;
          IVisitablePointable tag = allocator.allocateEmpty();
          IVisitablePointable item = allocator.allocateFieldValue(itemTag, b, itemOffset + 1);

          // set item type tag
          int start = dataBos.size();
          dataDos.writeByte(itemTag.serialize());
          int end = dataBos.size();
          tag.set(dataBos.getByteArray(), start, end - start);
          itemTags.add(tag);

          // open part field already include the type tag
          item.set(b, itemOffset, itemLength);
          itemOffset += itemLength;
          items.add(item);
        }
      }
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
 private void reset() {
   allocator.reset();
   items.clear();
   itemTags.clear();
   dataBos.reset();
 }