Base64 encoding in Velocity?

Is there any way to get Base64 encoding in Velocity (inside a custom widget)?

I am aware of the escape tools (…) available under $tools.esc, but I’m afraid that isn’t quite what we’re looking for.

I do know that the option is available in Java under the org.apache.commons.codec.binary.Base64 namespace, but am unsure how / if that can be used in Velocity. And there might not be any easy way (aside from rolling-your-own), but wanted to ask just in case I was missing something.