Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bjing/f7c54ba35b56f5bcbd60a4f95bbf4aab to your computer and use it in GitHub Desktop.
Save bjing/f7c54ba35b56f5bcbd60a4f95bbf4aab to your computer and use it in GitHub Desktop.

Revisions

  1. @frgomes frgomes created this gist Jul 28, 2017.
    7 changes: 7 additions & 0 deletions scala_base64_encode_decode.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    // 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)