Jump to content
xisto Community
clemen

Base64 Encode And Decode

Recommended Posts

I read a claim that there was a method in java.util.prefs, but otherwise it seems like people have just gone and made their own classes and/or methods. I've also head that there is an undocumented method called sun.misc.BASE64Encoder.encode.

 

Anyway, if you want some Base64 encoding/decoding I suggest you either make your own class to handle it, or download any of the ones you find by googling for java base64.

Share this post


Link to post
Share on other sites

Use Commons Codec from Apache Site
http://commons.apache.org/proper/commons-codec/

in package org.apache.commons.codec.binary
there is one class Base64

use static method :
* decodeBase64(byte[] base64Data)
* encodeBase64(byte[] binaryData)
* and be careful it works in array of bytes not String
* so beware of character encoding for Converting between your String to array of bytes.

Hopes this help you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.