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

Stringdecode(String value, String encoding)
Decodes an encoded String.
if (!needsDecoding(value)) {
    return value;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int charIndex = 0;
int length = value.length();
while (charIndex < length) {
    char aChar = value.charAt(charIndex);
...
byte[]decode3(String str)
decode
byte[] bt = null;
try {
    sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
    bt = decoder.decodeBuffer(str);
} catch (IOException e) {
    e.printStackTrace();
return bt;
...
StringdecodeString(String s)
decode String
try {
    if (s != null) {
        if (s.equals(new String(s.getBytes("iso8859-1"), "iso8859-1"))) {
            s = new String(s.getBytes("iso8859-1"), "utf-8");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
...
StringdecodeString(String s, String charset)
Decodes a string from Base64 format.
return new String(decode(s), charset);
byte[]decodeString(String s, String encoding)
decode String
if (s == null)
    return null;
try {
    return s.getBytes(encoding);
} catch (UnsupportedEncodingException e) {
    throw new RuntimeException("Unsupported encoding " + encoding, e);
StringdecodeString(String str)
Decode a string using Base64 encoding.
BASE64Decoder dec = new BASE64Decoder();
String value = new String(dec.decodeBuffer(str));
return (value);
StringdecodeString(String str)
Decode a string using Base64 encoding.
sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder();
try {
    return new String(dec.decodeBuffer(str));
} catch (IOException io) {
    throw new RuntimeException(io.getMessage(), io.getCause());
StringdecodeString(StringReader in)
Decode a string previously encoded through encodeString.
Integer len = decodeInt(in);
if (len == null) {
    return null;
char[] chars = new char[len];
in.read(chars);
return new String(chars);
StringdecodeStringFromByteArray(byte[] data)
Decodes a string object from the given byte array.
String args = null;
if (data != null) {
    StringBuilder builder = new StringBuilder();
    InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(data));
    try {
        int c = reader.read();
        while (c != -1) {
            builder.append(c != 0 ? Character.valueOf((char) c).charValue() : ' ');
...
String[]decodeStrings(byte[] stringBytes)
decode Strings
return decodeStrings(stringBytes, 0, (stringBytes == null) ? 0 : stringBytes.length);