Saturday, June 1, 2013

Base64 Encoder and Decoder in Java


There are many third party libraries providing Base64 encoding and decoding functions. Many of them are open source solution. I am not going to say too much on the topic. I would just provide my implementation here. If you want to know more, go to the wiki page.


The source contains over 200 lines, however about half of them are comments and unit test. Hence the encode() and decode() function are not really complex. In case you find reading other programmer code difficult. I would provide a typical way of how I read other people code.

Read the comment header first, then scroll down to the main program to see how to use the functions. Then read the functions following the flow in main().

No comments:

Post a Comment