Android Utililty Methods Base64 Byte Array Encode

List of utility methods to do Base64 Byte Array Encode

Description

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

Method

Stringencode(byte[] bytes)
encode
return new String(Base64.encode(bytes, Base64.DEFAULT));
Stringencode(byte[] data)
encode
StringBuffer sb = new StringBuffer();
int len = data.length;
int i = 0;
int b1, b2, b3;
while (i < len) {
    b1 = data[i++] & 0xff;
    if (i == len) {
        sb.append(base64EncodeChars[b1 >>> 2]);
...
Stringencode(byte[] arr)
Converts byte array to String
return Base64.encodeToString(arr, Base64.DEFAULT);
Stringencode(byte[] data)
encode
StringBuffer sb = new StringBuffer();
int len = data.length;
int i = 0;
int b1, b2, b3;
while (i < len) {
    b1 = data[i++] & 0xff;
    if (i == len) {
        sb.append(base64EncodeChars[b1 >>> 2]);
...
StringencodeWebSafe(byte[] source, boolean doPadding)
Encodes a byte array into web safe Base64 notation.
return encode(source, 0, source.length, WEBSAFE_ALPHABET, doPadding);
Stringencode(byte[] bytes)
encode
if (bytes == null) {
    return null;
if (bytes.length == 0) {
    return "";
int groupCount = bytes.length / 3;
StringBuffer resultBuffer = new StringBuffer();
...
Stringencode(byte[] data)
encode
StringBuffer sb = new StringBuffer();
int len = data.length;
int i = 0;
int b1, b2, b3;
while (i < len) {
    b1 = data[i++] & 0xff;
    if (i == len) {
        sb.append(base64EncodeChars[b1 >>> 2]);
...
charencodeBase64Byte(byte base64Byte)
encode Base Byte
if ((base64Byte >= 0) && (base64Byte <= 25)) {
    return (char) (base64Byte + 65);
} else if ((base64Byte >= 26) && (base64Byte <= 51)) {
    return (char) (base64Byte - 26 + 97);
} else if ((base64Byte >= 52) && (base64Byte <= 61)) {
    return (char) (base64Byte - 52 + 48);
} else if (base64Byte == 62) {
    return '+';
...
StringencodeLast2Bytes(byte bytes[])
encode Last Bytes
byte firstByte = bytes[bytes.length - 2];
byte secondByte = bytes[bytes.length - 1];
StringBuffer resultBuffer = new StringBuffer();
byte bufferByte = 0;
bufferByte = (byte) (firstByte >> 2);
resultBuffer.append(encodeBase64Byte(bufferByte));
bufferByte = (byte) (((firstByte & 0x03) << 4) | (secondByte >> 4));
resultBuffer.append(encodeBase64Byte(bufferByte));
...
StringencodeLast1Byte(byte bytes[])
encode Last Byte
byte lastByte = bytes[bytes.length - 1];
StringBuffer resultBuffer = new StringBuffer();
byte bufferByte = 0;
bufferByte = (byte) (lastByte >> 2);
resultBuffer.append(encodeBase64Byte(bufferByte));
bufferByte = (byte) ((lastByte & 0x03) << 4);
resultBuffer.append(encodeBase64Byte(bufferByte));
resultBuffer.append('=');
...