groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Winnebeck, Jason" <Jason.Winneb...@windstream.com>
Subject RE: Binary to Base64 Conversion
Date Sat, 13 May 2017 02:17:41 GMT
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:Erick.Nelson@hdsupply.com]
Sent: Friday, May 12, 2017 10:07 PM
To: users@groovy.apache.org
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 <ssoguroo@gmail.com<mailto:ssoguroo@gmail.com>>
Reply-To: "users@groovy.apache.org<mailto:users@groovy.apache.org>" <users@groovy.apache.org<mailto:users@groovy.apache.org>>
Date: Friday, May 12, 2017 at 7:05 PM
To: "users@groovy.apache.org<mailto:users@groovy.apache.org>" <users@groovy.apache.org<mailto:users@groovy.apache.org>>
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.

Mime
View raw message