Forked from frgomes/scala_base64_encode_decode.scala
Created
September 29, 2020 17:06
-
-
Save junqueira/173866635f97212dc0edfe8a2dc3932d to your computer and use it in GitHub Desktop.
Scala - Base64 encode/decode
This file contains 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
// Base64 encode | |
val text = "This is plaintext." | |
val bytesEncoded = java.util.Base64.getEncoder.encode(text.getBytes()) | |
// Base64 decode | |
val textDecoded = new String(java.util.Base64.getDecoder.decode(bytesEncoded)) | |
println(textDecoded) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment