Java Utililty Methods Base64 Encode

List of utility methods to do Base64 Encode

Description

The list of methods to do Base64 Encode are organized into topic(s).

Method

Stringbase64Encode(String plainTextString)
Encodes a string using Base64 encoding.
String encoded = new String(Base64.getEncoder().encode(plainTextString.getBytes()));
return encoded;
Stringbase64Encode(String s)
base Encode
if (s == null)
    return null;
try {
    return (new sun.misc.BASE64Encoder()).encode(s.getBytes(DEFAULT_CHARSET));
} catch (UnsupportedEncodingException e) {
    return null;
Stringbase64encode(String s)
baseencode
return base64encode(s.getBytes());
Stringbase64Encode(String s)
base Encode
return encode(s.getBytes(), 0);
Stringbase64Encode(String s)
base Encode
StringBuilder sb = new StringBuilder();
StringReader r = new StringReader(s);
int c = 0;
int d = 0;
int e = 0;
int k = 0;
int end = 0;
byte u;
...
Stringbase64encode(String str)
baseencode
byte[] utf8;
try {
    utf8 = str.getBytes("UTF-8");
} catch (UnsupportedEncodingException ex) {
    throw new InternalError(ex.toString());
StringBuffer sb = new StringBuffer((utf8.length + 2) / 3 * 4);
int i;
...
Stringbase64Encode(String string)
base Encode
StringBuffer encoded = new StringBuffer();
byte utf8[] = stringToUTF8(string);
int i = 0;
while (i < utf8.length) {
    byte input1 = utf8[i++];
    byte input2 = i < utf8.length ? utf8[i++] : 0;
    byte input3 = i < utf8.length ? utf8[i++] : 0;
    int output1 = input1 >> 2;
...
Stringbase64Encode(String string)
base Encode
String encodedString = "";
byte bytes[] = string.getBytes();
int i = 0;
int pad = 0;
while (i < bytes.length) {
    byte b1 = bytes[i++];
    byte b2;
    byte b3;
...
Stringbase64encode(String text)
base64encode
try {
    return enc.encode(text.getBytes(DEFAULT_ENCODING));
} catch (UnsupportedEncodingException e) {
    return null;
Stringbase64EncodeGeneric(String digits, byte[] data)
base Encode Generic
if (data == null)
    throw new IllegalArgumentException("'data' can't be null");
if (digits == null)
    throw new IllegalArgumentException("'digits' can't be null");
if (digits.length() != 64)
    throw new IllegalArgumentException("'digits' must be 64 characters long: " + jq(digits));
int numGroupsOfThreeInputBytes = (data.length + 2) / 3;
int numOutputChars = numGroupsOfThreeInputBytes * 4;
...