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

Stringbase64Encoder(byte[] src, int start, int wrapAt)
base Encoder
return base64Encoder(src, start, src.length, wrapAt);
Stringbase64Encoder(String str)
base Encoder
byte[] b = null;
String s = null;
try {
    b = str.getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
if (b != null) {
...
Stringbase64encoding(byte[] bytes)
baseencoding
Encoder encoder = Base64.getEncoder();
return encoder.encodeToString(bytes);
byte[]base64UrlDecode(final String encodedString)
base Url Decode
return base64UrlDecode(encodedString.getBytes());
Stringbase64UrlEncode(final byte[] v)
base Url Encode
return BASE64_ENC.encodeToString(v).replaceAll("=*$", "");
intencodeBASE64(InputStream in, OutputStream out)
This implements a BASE64 character decoder as specified in RFC1521.
int len;
int count = 0;
byte[] chunk = new byte[3];
while ((len = in.read(chunk)) > 0) {
    byte a, b, c;
    count += len;
    if (len == 1) {
        a = chunk[0];
...
intencodeBase64(InputStream is, OutputStream os)
encode Base
int written = 0;
int avail;
byte[] buffer = { '=', '=', '=', '=' };
int i;
int value = 0;
while ((avail = is.available()) > 0) {
    if (avail > 3)
        avail = 3;
...
StringencodeBase64(String data)
Encodes a String as a base64 String.
byte[] bytes = null;
try {
    bytes = data.getBytes("UTF-8");
} catch (UnsupportedEncodingException uee) {
    uee.printStackTrace();
return encodeBase64(bytes);
StringencodeBase64(String data)
Encodes a String as a base64 String.
return encodeBase64(data.getBytes("GBK"));
StringtoBase64(byte[] array)
to Base
return Base64.getEncoder().encodeToString(array);