gwt/3.3/src/pubnub/api/Pubnub.java
/**
    * Encodes a byte array into Base64 format.
    * No blanks or line breaks are inserted.
    *
    * @param in   an array containing the data bytes to be encoded.
    * @param iLen number of bytes to process in <code>in</code>.
    * @return     A character array with the Base64 encoded data.
    */
Encodes a byte array into Base64 format.
No blanks or line breaks are inserted.

@param in   an array containing the data bytes to be encoded.
@param iLen number of bytes to process in in.
@return     A character array with the Base64 encoded data.
Encodes a byte array into Base64 format . No blanks or line breaks are inserted . @param in an array containing the data bytes to be encoded . @param iLen number of bytes to process in in . @return A character array with the Base64 encoded data .
public static char[] encode (byte[] in, int iLen) {
        int oDataLen = (iLen*4+2)/3;       
        int oLen = ((iLen+2)/3)*4;         
        char[] out = new char[oLen];
        int ip = 0;
        int op = 0;
        while (ip < iLen) {
            int i0 = in[ip++] & 0xff;
            int i1 = ip < iLen ? in[ip++] & 0xff : 0;
            int i2 = ip < iLen ? in[ip++] & 0xff : 0;
            int o0 = i0 >>> 2;
            int o1 = ((i0 &   3) << 4) | (i1 >>> 4);
            int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
            int o3 = i2 & 0x3F;
            out[op++] = map1[o0];
            out[op++] = map1[o1];
            out[op] = op < oDataLen ? map1[o2] : '=';
            op++;
            out[op] = op < oDataLen ? map1[o3] : '=';
            op++;
        }
        return out;
    }
public static char [ ] encode ( byte [ ] in , int iLen ) { int oDataLen = ( iLen * 4 + 2 ) / 3 ; int oLen = ( ( iLen + 2 ) / 3 ) * 4 ; char [ ] out = new char [ oLen ] ; int ip = 0 ; int op = 0 ; while ( ip < iLen ) { int i0 = in [ ip ++ ] & 0xff ; int i1 = ip < iLen ? in [ ip ++ ] & 0xff : 0 ; int i2 = ip < iLen ? in [ ip ++ ] & 0xff : 0 ; int o0 = i0 >>> 2 ; int o1 = ( ( i0 & 3 ) << 4 ) | ( i1 >>> 4 ) ; int o2 = ( ( i1 & 0xf ) << 2 ) | ( i2 >>> 6 ) ; int o3 = i2 & 0x3F ; out [ op ++ ] = map1 [ o0 ] ; out [ op ++ ] = map1 [ o1 ] ; out [ op ] = op < oDataLen ? map1 [ o2 ] : '=' ; op ++ ; out [ op ] = op < oDataLen ? map1 [ o3 ] : '=' ; op ++ ; } return out ; }
Encodes a byte array into Base64 format.
Encodes a byte array into Base64 format .
// output length without padding // output length including padding