Say for example you have a custom field in the database that stores an email and you want to display that email on a page somewhere. You don't really want to allow every spam or virus harvest bot out there to come and grab the email. That is why Joomla! created the cloak function. It just makes sense to protect ppl's emails.
To cloak the email simply enter the following code.
$email = 'firstname.lastname@example.org';
$emcloaked = JHTML::_('Email.cloak',$email);
And that is it.