public static Class<?> loadClass(@Nullable final ClassLoader classLoader, final String className) throws ClassNotFoundException {
        if (className == null) {
            throw new IllegalArgumentException("ClassName cannot be null!");
        }
        if (className.length() <= MAX_PRIM_CLASSNAME_LENGTH && Character.isLowerCase(className.charAt(0))) {
            for (int i = 0; i < PRIMITIVE_CLASSES_ARRAY.length; i++) {
                if (className.equals(PRIMITIVE_CLASSES_ARRAY[i].getName())) {
                    return PRIMITIVE_CLASSES_ARRAY[i];
                }
            }
        }
        ClassLoader theClassLoader = classLoader;

        if (theClassLoader == null) {
            theClassLoader = Thread.currentThread().getContextClassLoader();
        }
        if (theClassLoader != null) {
            if (className.startsWith("[")) {
                return Class.forName(className, true, theClassLoader);
            } else {
                return theClassLoader.loadClass(className);
            }
        }
        return Class.forName(className);
    }
Reads a Map of Serializable 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 Serializable key and 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