[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

Bas64 usage

Hello All,

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

How can i do that

Thanks
0
iknowit75
Asked:
iknowit75
  • 2
1 Solution
 
sudhakar_koundinyaCommented:
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
 
sudhakar_koundinyaCommented:
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now