protected void writeAMF3AssociativeArray(Map<?, ?> map) throws IOException {
        if (debugMore) debug("writeAMF3AssociativeArray(array=", map, ")");

        write(AMF3_ARRAY);

        int index = indexOfStoredObjects(map);
        if (index >= 0) {
            writeAMF3IntegerData(index << 1);
        } else {
            addToStoredObjects(map);

            write(0x01);

            for (Object key : map.keySet()) {
                writeAMF3StringData(key.toString());
                writeObject(map.get(key));
            }
            writeAMF3StringData("");
        }
    }