Utility method for decoding a base-64-encoded string.

@param value The base-64-encoded string.
@return The decoded value.
966576
private static byte[] base64Decode(String value) {
    if (value == null) {
      return null;
    }
    
    try {
      return Base64.decodeBase64(value.getBytes("UTF-8"));
    }
    catch (UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
  }
718034
public static int computeStringSizeNoTag(final String value) {
    try {
      final byte[] bytes = value.getBytes("UTF-8");
      return computeRawVarint32Size(bytes.length) +
             bytes.length;
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException("UTF-8 not supported.", e);
    }
  }
1055841
public static long longFromBase64(String value) {
        int pos = 0;
        long longVal = base64Values[value.charAt(pos++)];
        int len = value.length();
        while (pos < len) {
            longVal <<= 6;
            longVal |= base64Values[value.charAt(pos++)];
        }
        return longVal;
    }
454162
public static UByte valueOf(String value) throws NumberFormatException {
        return valueOfUnchecked(rangeCheck(Short.parseShort(value)));
    }
1282552
public static String decodeToStr(String value) {
        byte[] decodedValue = delegate.decode(value);
        return new String(decodedValue, UTF_8);
    }
644995
@Override
    public String hexMD5(String value) {
        return String.valueOf(Hex.encodeHex(md5(value)));
    }
148979
public static byte[] decode(String string)
    {
        if (string.length() % 5 != 0) {
            return null;
        }
        ByteBuffer buf = ByteBuffer.allocate(string.length() * 4 / 5);

        int byteNbr = 0;
        int charNbr = 0;
        int stringLen = string.length();
        long value = 0;
        while (charNbr < stringLen) {
            //  Accumulate value in base 85
            value = value * 85 + (decoder[string.charAt(charNbr++) - 32] & 0xff);
            if (charNbr % 5 == 0) {
                //  Output value in base 256
                int divisor = 256 * 256 * 256;
                while (divisor != 0) {
                    buf.put(byteNbr++, (byte) ((value / divisor) % 256));
                    divisor /= 256;
                }
                value = 0;
            }
        }
        assert (byteNbr == string.length() * 4 / 5);
        return buf.array();
    }
143530
private static StringBuilder toBase64(long value) {
		StringBuilder result = new StringBuilder(23); // Initialize with the size of ID if using Base64
		for(int shift=60; shift>=0; shift-=6) {
			result.append(Base64[(int)((value >> shift) & 0x3F)]);
		}
		return result;
	}
258212
private String getEscapedValue(String value) {
        if (value != null) {
            try {
                return URLEncoder.encode(value, "UTF-8");
                
            } catch ( UnsupportedEncodingException ex) { }            
        }
        
        return "";
    }
1159505
private static function decode_value($value, $encoding)
    {
        switch (strtolower($encoding)) {
        case 'quoted-printable':
            self::$values_decoded = true;
            return quoted_printable_decode($value);

        case 'base64':
        case 'b':
            self::$values_decoded = true;
            return base64_decode($value);

        default:
            return $value;
        }
    }
1159949
public KeySignParameters withValue(byte[] value) {
        if (value == null) {
            this.value = null;
        } else {
            this.value = Base64Url.encode(value);
        }
        return this;
    }
846704
public static String encodeString(String value) {
    if (value == null) {
      return null;
    }
    StringBuilder encoded = new StringBuilder();
    int len = value.length();
    for (int i = 0; i < len; i++) {
      char c = value.charAt(i);
      switch (c) {
        case ARRAY_DELIMITER_CHAR:
        case KEY_VALUE_DELIMITER_CHAR:
        case ESCAPE_CHAR:
          encoded.append(ESCAPE_CHAR);
          break;
        default:
          // just append char
      }
      encoded.append(c);
    }
    return encoded.toString();
  }
1301957
@SneakyThrows
    public static String urlDecode(final String value) {
        return URLDecoder.decode(value, StandardCharsets.UTF_8.name());
    }
1273727
@SuppressWarnings({"unchecked", "rawtypes"})
    public U encode(Object value) {
        requireNonNull(value, "Value for encoding can not be null");

        TypeEncoder encoder = classMapping.get(value.getClass());
        if (encoder != null)
            return (U) encoder.encode(value);

        throw new TypeEncodingException("An unknown type [" + value.getClass() + "] was encountered");
    }
1122680
public static String decodeString(String str) {
		try {
			return new String(Base64.decode(str));
		} catch (IOException io) {
			throw new RuntimeException(io.getMessage(), io.getCause());
		}
	}
349600
function encodeUInt64(value) {
    let buffer = new ByteBuffer();
    if (value === null) {
        return buffer;
    }
    return buffer.writeVarint64(value.toString());
}
882586
@Deprecated
    public static String encodeBASE64(String value) {
        return new String(Base64.encode(value.getBytes(Charsets.UTF_8)));
    }