base64 Decode using sun.misc.BASE64Decoder - Java java.lang

Java examples for java.lang:String Base64

Description

base64 Decode using sun.misc.BASE64Decoder

Demo Code


//package com.java2s;
import sun.misc.BASE64Decoder;

public class Main {
    public static void main(String[] argv) throws Exception {
        String input = "java2s.com";
        System.out.println(java.util.Arrays.toString(base64Decode(input)));
    }/*from   www  .  j  av a2s .co  m*/

    public static byte[] base64Decode(String input) {
        try {
            BASE64Decoder base64Decoder = new BASE64Decoder();
            byte[] bytes = base64Decoder.decodeBuffer(input);
            return bytes;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related Tutorials