January 3, 2017

Java 8 - Base64

Java 8 now supports java.util.Base64.

  • Base64.getEncoder()/Base64.getDecoder() - Output is mapped to a set of characters lying in A-Za-z0-9+/.
  • Base64.getUrlEncoder()/Base64.getUrlDecoder() - Output is mapped to set of characters lying in A-Za-z0-9+_. Output is URL and filename safe.
  • Base64.getMimeEncoder()/Base64.getMimeDecoder() - Simple format, but represented in lines of 76 characters and seperated with '\r\n'.

Example

Output

No comments: