public int readExternalizableMap(DataInput in, Map<String, ? extends Externalizable> map, ClassLoader loader) throws IOException {
        Map<String, Externalizable> result = (Map<String, Externalizable>) readObject(loader, in);
        if (result == null) return 0;
        ((Map<String, Externalizable>)map).putAll(result);
        return result.size();
    }
Reads a Map of String key and value pairs. This method will return
<tt>null</tt> if the Map written to the stream was <tt>null</tt>.

@param in the input stream.
@param map a Map of String key and Externalizable value pairs.
@param loader class loader to use to build elements inside of the serialized collection.
@throws IOException if an error occurs.
@return the number of elements added to the collection.
xmppserver/src/main/java/org/jivesoftware/util/cache/DefaultExternalizableUtil.java