Code example for InvalidObjectException

0
			throw new NullPointerException("cls");
		 
		Object obj = deserialize(in, cls);
		if (!cls.isInstance(obj))
		{ 
			throw new InvalidObjectException("type of deserialized instance not of required class.");
		} 
		 
		return obj;
	} 
	 
	/** 
	 * Deserializes an object from the given <code>InputStream</code>. 
	 * The deserialization is delegated to an <code> 
	 * ObjectInputStream</code> instance.  
	 *  
	 * @param in	The <code>InputStream</code> to deserialize an object 
	 *				from. 
	 *  
	 * @return The object deserialized from the stream.  
	 * @exception IOException is thrown if there was a problem reading