Decodes the given base-64 string to a byte array.

@param base64String A base-64 encoded string.
@return The decoded byte array.
507773
public static byte[] fromBase64(String base64String) {

        byte[] result = null;
        if (base64String != null) {
            result = Base64.decodeBase64(base64String);
        }
        return result;
    }
679376
public static byte[] decode(String s) {

        if( s == null ){
            throw new IllegalArgumentException("Input string was null.");
        }

        byte[] inBytes;
        try {
            inBytes = s.getBytes("US-ASCII");
        }
        catch( java.io.UnsupportedEncodingException uee ) {
            inBytes = s.getBytes();
        }

        if( inBytes.length == 0 ) {
            return new byte[0];
        } else if( inBytes.length < 4 ){
            throw new IllegalArgumentException(
                    "Base64-encoded string must have at least four characters, but length specified was " + inBytes.length);
        }   // end if

        return decodeBytes(inBytes);
    }
691392
public static String bytesToBase64Str(byte[] bytes) {
        if (ArrayUtils.isEmpty(bytes)) {
            return null;
        }
        Base64.Encoder encoder = Base64.getEncoder();
        String base64Str = encoder.encodeToString(bytes);
        return base64Str;
    }
242037
public static byte[] decode(String text) throws Exception
	{
		if (text.length() % 4 != 0)
		{
			throw new Exception("Base64 not a multiple of 4 bytes");
		}

		byte[] result = new byte[text.length() / 4 * 3];
		int p = 0;

		for (int i = 0; i < text.length();)
		{
			if (text.charAt(i) == '\n')
			{
				continue;
			}

			int b1 = b64decode(text.charAt(i++));
			int b2 = b64decode(text.charAt(i++));
			int b3 = b64decode(text.charAt(i++));
			int b4 = b64decode(text.charAt(i++));

			if (b4 >= 0)
			{
				int three = b4 | b3 << 6 | b2 << 12 | b1 << 18;
				result[p++] = (byte) ((three & 0xff0000) >> 16);
				result[p++] = (byte) ((three & 0xff00) >> 8);
				result[p++] = (byte) (three & 0xff);
			} else if (b3 >= 0)
			{
				int two = b3 << 6 | b2 << 12 | b1 << 18;
				result[p++] = (byte) ((two & 0xff0000) >> 16);
				result[p++] = (byte) ((two & 0xff00) >> 8);
			} else
			{
				int one = b2 << 12 | b1 << 18;
				result[p++] = (byte) ((one & 0xff0000) >> 16);
			}
		}

		byte[] output = new byte[p];
		System.arraycopy(result, 0, output, 0, p);

		return output;
	}
1124371
public static byte[] decode(byte[] in) {
        return org.apache.commons.codec.binary.Base64.decodeBase64(in);
    }
292866
private byte[] decodeBytes(String cipherString) {
        String[] cipherStringBytes = cipherString.split(":");
        byte[] cipherBytes = new byte[cipherStringBytes.length];
        for (int i = 0; i < cipherStringBytes.length; i++) {
            cipherBytes[i] = Byte.parseByte(cipherStringBytes[i]);
        }
        return cipherBytes;
    }
933314
public static String base64dec(String str) {
		if (str == null) {
			return "";
		}
		try {
			return new String(Base64.decodeBase64(str), Config.DEFAULT_ENCODING);
		} catch (UnsupportedEncodingException ex) {
			return "";
		}
	}
616633
def decode(string):
    
    if not string:
        return bytes()
    elif isinstance(string, str):
        return a2b_base64(string.encode('raw-unicode-escape'))
    else:
        return a2b_base64(string)
583209
@SneakyThrows(IOException.class)
    public static String compressToBase64(final String string) {
        Preconditions.checkNotNull(string, "string");
        @Cleanup
        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        @Cleanup
        final OutputStream base64OutputStream = Base64.getEncoder().wrap(byteArrayOutputStream);
        @Cleanup
        final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(base64OutputStream);
        gzipOutputStream.write(string.getBytes(UTF_8));
        gzipOutputStream.close();
        return byteArrayOutputStream.toString(UTF_8.name());
    }
700219
def decode(string, base):
    

    base = int(base)
    code_string = get_code_string(base)
    result = 0
    if base == 16:
        string = string.lower()
    while len(string) > 0:
        result *= base
        result += code_string.find(string[0])
        string = string[1:]
    return result
840981
public static JWEHeader fromBase64String(String base64) throws IOException {
        String json = MessageSecurityHelper.base64UrltoString(base64);
        return deserialize(json);
    }
946016
@Nullable protected byte[] decode(@Nullable String data) {
    return data == null ? null : Base64.getUrlDecoder().decode(data);
  }
1254205
function tryParseBase64ToBytes(b64Str) {
    let decodedStr;

    try {
      decodedStr = atob(b64Str);
    } catch (e) {
      return null;
    }

    return Uint8Array.from(decodedStr, c => c.charCodeAt(0));
  }
480667
function decodeBase64(sEncoded) {

    // Input must be dividable with 4.
    if (!sEncoded || (sEncoded.length % 4) > 0) { return sEncoded; }
    else if (typeof (atob) != 'undefined') { return atob(sEncoded); }

    var nBits, i, sDecoded = '';
    var base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

    sEncoded = sEncoded.replace(/\W|=/g, '');
    for (i = 0; i < sEncoded.length; i += 4) {
        nBits =
            (base64.indexOf(sEncoded.charAt(i)) & 0xff) << 18 |
            (base64.indexOf(sEncoded.charAt(i + 1)) & 0xff) << 12 |
            (base64.indexOf(sEncoded.charAt(i + 2)) & 0xff) << 6 |
             base64.indexOf(sEncoded.charAt(i + 3)) & 0xff;
        sDecoded += String.fromCharCode(
            (nBits & 0xff0000) >> 16, (nBits & 0xff00) >> 8, nBits & 0xff);
    }
    return sDecoded.substring(0, sDecoded.length -
        ((sEncoded.charCodeAt(i - 2) == 61) ? 2 :
        (sEncoded.charCodeAt(i - 1) == 61 ? 1 : 0)));

}
696456
public static byte[] fromBase64(String data) {
    if (data == null) {
      return null;
    }

    int len = data.length();
    assert (len % 4) == 0;

    if (len == 0) {
      return new byte[0];
    }

    char[] chars = new char[len];
    data.getChars(0, len, chars, 0);

    int olen = 3 * (len / 4);
    if (chars[len - 2] == '=') {
      --olen;
    }
    if (chars[len - 1] == '=') {
      --olen;
    }

    byte[] bytes = new byte[olen];

    int iidx = 0;
    int oidx = 0;
    while (iidx < len) {
      int c0 = base64Values[chars[iidx++] & 0xff];
      int c1 = base64Values[chars[iidx++] & 0xff];
      int c2 = base64Values[chars[iidx++] & 0xff];
      int c3 = base64Values[chars[iidx++] & 0xff];
      int c24 = (c0 << 18) | (c1 << 12) | (c2 << 6) | c3;

      bytes[oidx++] = (byte) (c24 >> 16);
      if (oidx == olen) {
        break;
      }
      bytes[oidx++] = (byte) (c24 >> 8);
      if (oidx == olen) {
        break;
      }
      bytes[oidx++] = (byte) c24;
    }

    return bytes;
  }
955223
public static String base64Decode(String base64Str,String encoding) throws IOException{
		byte [] rawByte = base64Str.getBytes(encoding);
		return new String(SecureUtil.base64Decode(rawByte),encoding);	
	}
563240
public static byte[] decode(String string) {
        int length = string.length();
        if (length == 0) return new byte[0];
        int pad = (string.charAt(length - 2) == '=') ? 2 :
                (string.charAt(length - 1) == '=') ? 1 : 0;
        int size = length * 3 / 4 - pad;
        byte[] buffer = new byte[size];
        int block;
        int i = 0;
        int index = 0;
        while (i < length) {
            block = (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 18 |
                    (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 12 |
                    (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 6 |
                    (ALPHABET.indexOf(string.charAt(i++)) & 0xff);
            buffer[index++] = (byte) (block >>> 16);
            if (index < size) buffer[index++] = (byte) ((block >>> 8) & 0xff);
            if (index < size) buffer[index++] = (byte) (block & 0xff);
        }
        return buffer;
    }