Created
February 23, 2012 11:23
What's new in Groovy 1.8.6 -- byte[].encodeHex
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
String input = 'Groovy Base64 Encode' | |
String encoded = input.bytes.encodeBase64() | |
assert encoded == 'R3Jvb3Z5IEJhc2U2NCBFbmNvZGU=' | |
byte[] decoded = encoded.decodeBase64() | |
assert input == new String( decoded ) |
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
String input = 'Groovy Hex Encode' | |
String encoded = input.bytes.encodeHex() | |
assert encoded == '47726f6f76792048657820456e636f6465' | |
byte[] decoded = encoded.decodeHex() | |
assert input == new String( decoded ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment