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

byte[]base64Encode(byte[] data)
Base64 encoding using Base64#getEncoder() encoder
return Base64.getEncoder().encode(data);
Stringbase64Encode(byte[] in)
BASE64-encodes the specified byte array.
int outLength = (in.length * 4 + 2) / 3; 
char[] out = new char[((in.length + 2) / 3) * 4]; 
int iIn = 0;
int iOut = 0;
while (iIn < in.length) {
    int i0 = in[iIn++] & 0xff;
    int i1 = iIn < in.length ? in[iIn++] & 0xff : 0;
    int i2 = iIn < in.length ? in[iIn++] & 0xff : 0;
...
Stringbase64Encode(byte[] in)
Encode an array of bytes as a Base64 string
StringBuilder out = new StringBuilder((in.length * 4) / 3);
int b;
for (int i = 0; i < in.length; i += 3) {
    b = (in[i] & 0xFC) >> 2;
    out.append(codes.charAt(b));
    b = (in[i] & 0x03) << 4;
    if (i + 1 < in.length) {
        b |= (in[i + 1] & 0xF0) >> 4;
...
Stringbase64Encode(byte[] in)
Encodes a byte array into Base64 format.
int iOff = 0;
int iLen = in.length;
int oDataLen = (iLen * 4 + 2) / 3;
int oLen = ((iLen + 2) / 3) * 4;
char[] out = new char[oLen];
int ip = iOff;
int iEnd = iOff + iLen;
int op = 0;
...
StringBase64Encode(byte[] input, boolean addLineBreaks)
Base Encode
int length = input.length;
StringBuilder out = new StringBuilder("");
char one;
char two;
char three;
int i;
for (i = 0; i < length && length - i >= 3;) {
    one = (char) input[i++];
...
byte[]base64Encode(byte[] param)
base Encode
return Base64.getEncoder().encode(param);
Stringbase64encode(final byte[] data)
baseencode
final Base64.Encoder encoder = Base64.getEncoder();
return encoder.encodeToString(data);
Stringbase64Encode(int value)
Utility method for producing a (psuedo) base 64 encoding of an int value, suitable for inclusion in a file name.
StringBuffer buffer = new StringBuffer(6);
for (int i = 0; i < 4; i++)
    buffer.append(_BASE_64_CHARS[((value >> (6 * i)) & 0x3f)]);
return buffer.toString();
Stringbase64Encode(String _s, String _enc)
base 64 encoding, string converted to bytes using specified encoding
if (_s == null)
    return null;
if (_enc == null)
    _enc = ISO_8859_1;
try {
    return base64Encode(_s.getBytes(_enc));
} catch (Exception e) {
    e.printStackTrace();
...
Stringbase64Encode(String plaintext)
base Encode
try {
    return new BASE64Encoder().encode(plaintext.getBytes(CHAR_SET)).replace("\r\n", "").replace("\n", "");
} catch (UnsupportedEncodingException e) {
    return new BASE64Encoder().encode(plaintext.getBytes()).replace("\r\n", "").replace("\n", "");