Java Utililty Methods String Decode

List of utility methods to do String Decode

Description

The list of methods to do String Decode are organized into topic(s).

Method

byte[]decode(String s)
Base64 encoding methods of Authentication Taken from http://iharder.sourceforge.net/current/java/base64/ (public domain) and adapted for our needs here.
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();
...
Tdecode(String s, Class clazz)
decode
return objectMapper.readValue(s, clazz);
Stringdecode(String s, String charset1, String charset2)
decode
if (s != null) {
    try {
        return new String(s.getBytes(charset1), charset2);
    } catch (UnsupportedEncodingException e) {
return Empty;
Stringdecode(String s, String enc, boolean plusToSpace)
Decodes a String URL encoded URL
boolean modified = false;
if (enc == null || enc.length() == 0) {
    enc = "UTF-8";
int numChars = s.length();
StringBuilder sb = new StringBuilder(numChars > 500 ? numChars / 2 : numChars);
int i = 0;
char c;
...
Stringdecode(String s, String encoding)
decode
Matcher matcher = ENCODED_VALUE_PATTERN.matcher(s);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while (matcher.find()) {
    String matched = matcher.group();
    if (matched.startsWith("%")) {
        Integer value = Integer.parseInt(matched.substring(1), 16);
        bos.write(value);
    } else {
...
byte[]decode(String str)
decode
byte[] data = str.getBytes("GBK");
int len = data.length;
ByteArrayOutputStream buf = new ByteArrayOutputStream(len);
int i = 0;
int b1, b2, b3, b4;
while (i < len) {
    do {
        b1 = base64DecodeChars[data[i++]];
...
byte[]decode(String str)
Decode string representation of Base64 encoded bytes.
try {
    byte[] bytes = str.getBytes("utf8");
    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
    InputStream is = MimeUtility.decode(bais, "Base64");
    byte[] tmp = new byte[bytes.length];
    int n = is.read(tmp);
    byte[] res = new byte[n];
    System.arraycopy(tmp, 0, res, 0, n);
...
Stringdecode(String str, String encoding)
decode
if (str == null || str.length() == 0)
    return str;
try {
    return new String(str.getBytes("iso-8859-1"), encoding);
} catch (UnsupportedEncodingException e) {
    return str;
Stringdecode(String string, String encoding)
decode
if (null == string || null == encoding)
    return null;
int posIndex = 0;
int decodeLen = string.endsWith("==") ? (string.length() - 2)
        : string.endsWith("=") ? (string.length() - 1) : string.length();
byte[] buff = new byte[decodeLen * 3 / 4];
int count4 = decodeLen - decodeLen % 4;
for (int i = 0; i < count4; i += 4) {
...
Stringdecode(String text)
decode
return MimeUtility.decodeText(text);