Android Base64 Encode encodeBase64(String input)

Here you can find the source of encodeBase64(String input)

Description

Encodes a string with Base64

Parameter

Parameter Description
input String to be encoded

Exception

Parameter Description
UnsupportedEncodingException an exception

Return

Base64 encoded input

Declaration

public static String encodeBase64(String input)
        throws UnsupportedEncodingException 

Method Source Code

//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);
    }
}

Related

  1. base64Encode(final byte[] data)
  2. encode(byte[] src)
  3. to64(String a)
  4. toBase64(byte[] barray)
  5. encodeBase64(byte abyte0[])
  6. encryptToBase64Text(String key, String src)
  7. generateBase64String(String inString)
  8. ImageBase64Decode(String base64_str)
  9. longKeyId2Base64String(long keyId)