Java Base64 Decode decodeBase64AsUtf8(String data)

Here you can find the source of decodeBase64AsUtf8(String data)

Description

decode Base As Utf

License

Apache License

Declaration

public static String decodeBase64AsUtf8(String data) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.UnsupportedEncodingException;

import com.google.common.io.BaseEncoding;

public class Main {
    public static final String UTF_8 = "UTF-8";

    public static String decodeBase64AsUtf8(String data) {
        return encodeAsUtf8(decodeAsBase64(data));
    }/*from  ww  w .j  ava 2  s. c o  m*/

    public static String encodeAsUtf8(byte[] bytes) {
        try {
            return new String(bytes, UTF_8);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

    public static byte[] decodeAsBase64(String data) {
        return BaseEncoding.base64().decode(data);
    }
}

Related

  1. decodeBase64(String base64Data)
  2. decodeBase64(String data)
  3. decodeBase64(String data)
  4. decodeBASE64(String pEncoded)
  5. decodeBase64(String str)
  6. decodeBase64Mime(String encoded)
  7. decodeBase64String(String str)