Here you can find the source of encodeBase64(String input)
Parameter | Description |
---|---|
input | String to be encoded |
Parameter | Description |
---|---|
UnsupportedEncodingException | an exception |
public static String encodeBase64(String input) throws UnsupportedEncodingException
//package com.java2s; import android.util.Base64; import java.io.UnsupportedEncodingException; public class Main { /**/* ww w. j a v a 2s . c o m*/ * Encodes a string with Base64 * * @param input String to be encoded * @return Base64 encoded input * @throws UnsupportedEncodingException */ public static String encodeBase64(String input) throws UnsupportedEncodingException { byte[] data = input.getBytes("UTF-8"); return Base64.encodeToString(data, Base64.DEFAULT); } }