You can use built-in encodeBase64 method in Groovy:

assert "AQID" == ([1,2,3] as byte[]).encodeBase64() as String

And you saw, decodeBase64 is the opposite. Does that do what you want?

Jason

From: Nelson, Erick [mailto:[email protected]]
Sent: Friday, May 12, 2017 10:07 PM
To: [email protected]
Subject: Re: Binary to Base64 Conversion

Apache Commons codec

https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html

Erick Nelson
Senior Developer
HD Supply, FM
Cell 858-740-6523
Home 760-930-0461

CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may 
contain information that is confidential, proprietary or exempt from 
disclosure, and subject to terms at: http://www.hdsupply.com/email.

From: RJ <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Friday, May 12, 2017 at 7:05 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Binary to Base64 Conversion

I have to deal with a binary value of base64 ID in a groovy script. So, first I 
need to covert binary data to base64 format and then decodeBase64().
Any clues/thoughts ? Thanks!!

This email message and any attachments are for the sole use of the intended 
recipient(s). Any unauthorized review, use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please contact the sender by 
reply email and destroy all copies of the original message and any attachments.

Reply via email to