Solved

Bas64 usage

Posted on 2004-08-29
2
347 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

828 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