Wednesday, August 24, 2011

Encoding and Decoding Strings using Base64 Encoder-Decoder

Hellow Fellaws,


Today in this post I will provide you an API which will make easy for you all to encode or decode the text using the famous Base64 Algorithm.


The API download link is provided below
Download Here


Lets begin to encode and decode the text


Lets Start



  • Import this JAR file in your project. I am using NetBeans to develop my demo code. Steps are provided to import API in your code using NetBeans
    • Right click on your project name present on left Pane of Netbeans (Under which you have your .java files etc.
    • Select Properties, in the Project Properties Frame select Libraries on left pane
    • Click on Add Jar/Folder and select the above JAR file
    • You are done with importing API in your project



  • Now comes the code part. Let me provide you details of the code 
    • The code first encodes the String "Testing My API" 
    • Then it prints the encoded text
    • This encoded text is then decoded back to original text
    • This decoded text is printed again
    • Below is the code with comments go through the code and try it yourself.



  • The output of the code is given below



  • Congrats, you just encoded and decoded your string using Base64 Algorithm

Thats it for this post


Take Care


Peace



For Any Query mail me: ravjot.singh.28@gmail.com

No comments:

Post a Comment