Skip to content

Instantly share code, notes, and snippets.

@langley
Created February 2, 2014 18:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save langley/8773065 to your computer and use it in GitHub Desktop.
Save langley/8773065 to your computer and use it in GitHub Desktop.
Base64 Encode/Decode using the org.apache.commons.codec included in Play2.2 from scala. This works in the "console" from the play app.
// Works in the console from a Play 2.2 project
import org.apache.commons.codec.binary.Base64
val encoded: Array[Byte] = Base64.encodeBase64("text to be encoded".getBytes)
val decoded: Array[Byte] = Base64.decodeBase64(encoded)
println(new String(decoded))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment