views:

892

answers:

4

Possible Duplicate:
Decode Base64 data in java

Thanks to everyone in advance,

I am aware of http://commons.apache.org/codec/api-release/org/apache/commons/codec/binary/Base64.html etc, can anyone point to me another option preferably one that does not require me to use external libraries.

Thanks,

Sam

+1  A: 

Why not use one from iharder.net? It is fast and it is in public domain.

Malcolm
Just curious: why would you recommend this over Commons Codec (which is, at least, more widely used)?
Jonik
It is small and completely free of any licenses. Commons codec is more like an all-purpose library, and this tiny library does only one thing and does it very well.
Malcolm
A: 

if you use Sun's jvm you can use sun.misc.BASE64Encoder/Decoder but it's not Open Source

diega
A: 

migbase64 is the fastest (according to their benchmark).

RealHowTo
A: 

Just wanted to answer this with some more information as people here seem to have missed your requirement for a utility for both Base64 and Quoted Printable.

Take a look at MimeUtility in Javamail here:

http://java.sun.com/products/javamail/javadocs/javax/mail/internet/MimeUtility.html

That provides encoding/decoding for both Base64 and Quoted Printable, amongst others, look at the decode method:

public static InputStream decode(InputStream is,
                                 String encoding) throws MessagingException

Commons Codec provides similar functionality in the form of QCodec and Base64, but no main method that I know of. Hope that helps.

Jon