
This led the industry into standards like MIME (Multipurpose Internet Mail Extensions). Since STMP (Simple Mail Transfer Protocol) only supported 7-bit ASCII characters within the messages, there was a need to be able to encode this binary data and convert it into a format that was universally supported without having to affect the current infrastructure of email servers and the SMTP protocol. During which time folks began to speculate with the possiblity of using attachments with things like images, videos or other binary data. The need for Base64 arose during the advent of email. Although there are several other variants among them Base16 and Base32, it is Base64 which is the most prevalent and popular. You will then configure your libraries in the Libraries tab on Java Build Path Dialog Screen (shown below).īase64 is one of several encoding schemes used to encode binary data in a text based representation (ASCII) using a radix-64 representation. Apache Commons Codec – 1.10 The Apache Commons Codec package contains simple encoder and decoders for various formats such as Base64, Hexadecimal, Soundex, and various encryption utilities (Crypt, MD5Crypt, Sha2Crypt).For this tutorial I am using VMware vFabric tc Server Developer Edition which is essentially an enhanced Tomcat instance integrated with Spring STS Tomcat 7 or greater or other popular container ( Weblogic, Websphere, Glassfish, JBoss, VMWare vFabric, etc).Favorite IDE Spring Tool Suite (STS), Eclipse IDE or NetBeans (I happen to be using STS because it comes with a Tomcat server built-in).In order to run this tutorial yourself, you will need the following: Base64 Encoding/Decoding Apache Commons Output.Base64 Encoding/Decoding using Apache Commons Library.Base64 Alphabet Characters Used for Encoding.Please reference our Java 8 tutorial called “Base64 Encoding and Decoding Examples in Java 8”. If you are using Java 8, you may be aware that it now natively supports Base64 encoding and decoding.
#Java base64 encoding how to#
In our other tutorials, we discuss how to perform “Base64 Encoding and Decoding Examples in Java using Google Guava”. In this tutorial we will discuss how to Encode and Decode using Base64 using Apache Commons Open Source library. Base64 Encoding and Decoding Examples in Java using Apache Commons
