Solved

Bas64 usage

Posted on 2004-08-29
2
337 Views
Last Modified: 2008-02-01
Hello All,

I would like to conver bytes to Bas64 content or vice versa

How can i do that

Thanks
0
Comment
Question by:iknowit75
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 125 total points
ID: 11927677
This example uses non-standard classes in the sun.misc package to convert to and from Base64. These classes may change in the future.

    try {
        // Convert a byte array to base64 string
        byte[] buf = new byte[]{0x41, 0x42};
        String s = new sun.misc.BASE64Encoder().encode(buf);
   
        // Convert base64 string to a byte array
        buf = new sun.misc.BASE64Decoder().decodeBuffer(s);
    } catch (IOException e) {
    }
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 11927693
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question