Created
December 22, 2017 23:40
-
-
Save mujahidk/7fdda0c69d11fc3e4a0907ce4ea77537 to your computer and use it in GitHub Desktop.
Base64 encoding and decoding in Groovy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def text = "Going to convert this to Base64 encoding!" | |
// Encode | |
def encoded = text.bytes.encodeBase64().toString() | |
println encoded | |
// Decode | |
byte[] decoded = encoded.decodeBase64() | |
println new String(decoded) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got it working. Thanks.