public final IAMIndexBuilder decode(final IAMCodec codec) throws IOException, IllegalArgumentException {
		final IAMINDEXTYPE xmlIndex = JAXB.unmarshal(IO.inputReaderFrom(codec.getSourceData()), IAMINDEXTYPE.class);

		final IAMIndexBuilder indexBuilder = new IAMIndexBuilder();
		codec.useByteOrder(IAMByteOrder.from(xmlIndex.byteOrder));
		final int mappingCount = IAMCodec._checkRange_(Integer.parseInt(xmlIndex.mappingCount), 1073741824);
		final int listingCount = IAMCodec._checkRange_(Integer.parseInt(xmlIndex.listingCount), 1073741824);

		final IAMMappingBuilder[] mappingBuilders = new IAMMappingBuilder[mappingCount];
		for (int i = 0; i < mappingCount; i++) {
			indexBuilder.putMapping(mappingBuilders[i] = new IAMMappingBuilder());
		}

		final IAMListingBuilder[] listingBuilders = new IAMListingBuilder[listingCount];
		for (int i = 0; i < listingCount; i++) {
			indexBuilder.putListing(listingBuilders[i] = new IAMListingBuilder());
		}

		for (final Object object: xmlIndex.mappingOrListing) {
			if (object instanceof IAMMAPPINGTYPE) {
				final IAMMAPPINGTYPE xmlMapping = (IAMMAPPINGTYPE)object;

				final IAMMappingBuilder mappingBuilder = mappingBuilders[IAMCodec._checkRange_(Integer.parseInt(xmlMapping.index), mappingCount)];
				final IAMFindMode mappingFindMode = IAMFindMode.from(xmlMapping.findMode);
				final IAMArrayFormat mappingKeyFormat = IAMArrayFormat.from(xmlMapping.keyFormat);
				final IAMArrayFormat mappingValueFormat = IAMArrayFormat.from(xmlMapping.valueFormat);

				final int oldCount = mappingBuilder.entryCount();
				for (final IAMENTRYTYPE xmlEntry: xmlMapping.entry) {
					final int[] key = mappingKeyFormat.parse(xmlEntry.key);
					final int[] value = mappingValueFormat.parse(xmlEntry.value);
					mappingBuilder.put(key, value);
				}
				final int newCount = mappingBuilder.entryCount();

				if (oldCount == newCount) throw new IllegalStateException("<mapping> incomplete");
				mappingBuilder.mode(mappingFindMode.toMode(newCount));

			} else {
				final IAMLISTINGTYPE xmlListing = (IAMLISTINGTYPE)object;

				final IAMListingBuilder listingBuilder = listingBuilders[IAMCodec._checkRange_(Integer.parseInt(xmlListing.index), listingCount)];
				final IAMArrayFormat listingItemFormat = IAMArrayFormat.from(xmlListing.itemFormat);

				final int oldCount = listingBuilder.itemCount();
				for (final IAMITEMTYPE xmlItem: xmlListing.item) {
					final int[] data = listingItemFormat.parse(xmlItem.data);
					listingBuilder.put(data, false);
				}
				final int newCount = listingBuilder.itemCount();

				if (oldCount == newCount) throw new IllegalStateException("<listing> incomplete");

			}
		}

		return indexBuilder;
	}