Android Utililty Methods Byte Array Encode

List of utility methods to do Byte Array Encode

Description

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

Method

Stringencode(byte[] source, int off, int len, byte[] alphabet, boolean doPadding)
Encodes a byte array into Base64 notation.
byte[] outBuff = encode(source, off, len, alphabet,
        Integer.MAX_VALUE);
int outLen = outBuff.length;
while (doPadding == false && outLen > 0) {
    if (outBuff[outLen - 1] != '=') {
        break;
    outLen -= 1;
...
byte[]encode(byte[] source, int off, int len, byte[] alphabet, int maxLineLength)
Encodes a byte array into Base64 notation.
int lenDiv3 = (len + 2) / 3; 
int len43 = lenDiv3 * 4;
byte[] outBuff = new byte[len43 
        + (len43 / maxLineLength)]; 
int d = 0;
int e = 0;
int len2 = len - 2;
int lineLength = 0;
...
byte[]encode(byte[] source, int off, int len, byte[] alphabet, int maxLineLength)
Encodes a byte array into Base64 notation.
int lenDiv3 = (len + 2) / 3; 
int len43 = lenDiv3 * 4;
byte[] outBuff = new byte[len43 
        + (len43 / maxLineLength)]; 
int d = 0;
int e = 0;
int len2 = len - 2;
int lineLength = 0;
...
byte[]encode(byte[] source, int off, int len, byte[] alphabet, int maxLineLength)
Encodes a byte array into Base64 notation.
int lenDiv3 = (len + 2) / 3; 
int len43 = lenDiv3 * 4;
byte[] outBuff = new byte[len43 
        + (len43 / maxLineLength)]; 
int d = 0;
int e = 0;
int len2 = len - 2;
int lineLength = 0;
...
byte[]encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset, byte[] alphabet)
Encodes up to three bytes of the array source and writes the resulting four Base64 bytes to destination.
int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8)
        : 0)
        | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16)
                : 0)
        | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24)
                : 0);
switch (numSigBytes) {
case 3:
...
byte[]encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset, byte[] alphabet)
Encodes up to three bytes of the array source and writes the resulting four Base64 bytes to destination.
int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8)
        : 0)
        | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16)
                : 0)
        | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24)
                : 0);
switch (numSigBytes) {
case 3:
...
byte[]encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset, byte[] alphabet)
Encodes up to three bytes of the array source and writes the resulting four Base64 bytes to destination.
int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8)
        : 0)
        | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16)
                : 0)
        | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24)
                : 0);
switch (numSigBytes) {
case 3:
...
StringencodeToString(byte[] input, int flags)
Base64-encode the given data and return a newly allocated String with the result.
try {
    return new String(encode(input, flags), "US-ASCII");
} catch (UnsupportedEncodingException e) {
    throw new AssertionError(e);
StringencodeToString(byte[] input, int offset, int len, int flags)
Base64-encode the given data and return a newly allocated String with the result.
try {
    return new String(encode(input, offset, len, flags), "US-ASCII");
} catch (UnsupportedEncodingException e) {
    throw new AssertionError(e);
StringencodeWebSafe(byte[] source, boolean doPadding)
Encodes a byte array into web safe Base64 notation.
return encode(source, 0, source.length, WEBSAFE_ALPHABET, doPadding);