参数Encode
<p>Function: encode</p>
<p>Description: </p>

@param string
@return
@author acexy@thankjava.com
@date 2016年1月12日 上午11:55:53
@version 1.0
432426
public static String urlEncode(String string) {
        try {
            return URLEncoder.encode(string, CHARSET);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
580869
public static String urlDecode(String string) {
		try {
			return URLDecoder.decode(string, "utf-8");
		} catch (UnsupportedEncodingException e) {
			throw new RuntimeException(e);
		}
	}
86180
public static function encode($string)
    {
        if (is_array($string)) {
            foreach ($string as $k => $substring) {
                $string[$k] = static::encode($substring);
            }
        } else {
            $string = urlencode($string);
        }

        return $string;
    }
1031088
public static String encode(String value) {
        if (value == null) {
            return value;
        }
        try {
            value = URLEncoder.encode(value, Constants.UTF_8);
        } catch (UnsupportedEncodingException e) {
            // Do nothing - UTF-8 should always be supported
        }
        return value;
    }
683170
public static function encode($string) {
		$parts = explode('.', $string);
		foreach ($parts as &$part) {
			$part = self::to_ascii($part);
		}
		return implode('.', $parts);
	}
423795
private static function encodeString($string)
    {
        $length = mb_strlen($string, self::STRING_ENCODING);

        $data = self::encodeIntValue(MajorType::UTF8_STRING, $length);

        for ($i = 0; $i < $length; $i++)
        {
            $mbchar = mb_substr($string, $i, 1);
            $chars = strlen($mbchar);
            for ($j = 0; $j < $chars; $j++)
            {
                $data .= pack(PackFormat::UINT_8, ord($mbchar[$j]));
            }
        }

        return $data;
    }
1048517
public static String base64Encode(String plainTextString) {
        String encoded = new String(Base64.getEncoder().encode(plainTextString.getBytes()));
        return encoded;
    }
848282
protected function _encodeString(&$string)
    {
        // Escape these characters with a backslash or unicode escape:
        // " \ / \n \r \t \b \f
        $search  = array('\\', "\n", "\t", "\r", "\b", "\f", '"', '\'', '&', '<', '>', '/');
        $replace = array('\\\\', '\\n', '\\t', '\\r', '\\b', '\\f', '\\u0022', '\\u0027', '\\u0026',  '\\u003C', '\\u003E', '\\/');
        $string  = str_replace($search, $replace, $string);

        // Escape certain ASCII characters:
        // 0x08 => \b
        // 0x0c => \f
        $string = str_replace(array(chr(0x08), chr(0x0C)), array('\b', '\f'), $string);
        $string = self::encodeUnicodeString($string);

        return '"' . $string . '"';
    }
618337
public static String decodeString(final String string) {
		String decodedString = null;

		try {
			byte[] decodedBytes = decode(string);
			decodedString = new String(decodedBytes, "UTF-8");
		} catch (UnsupportedEncodingException uue) {
			// Should never happen, java has to support "UTF-8".
		}

		return decodedString;
	}
892871
@Deprecated
    public static String decode(String string)
    {
        try {
            byte[] bytes = Base64.decode(string.toCharArray());
            return new String(bytes, DEFAULT_ENCODING);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
341424
public static String encodeString(String s) {

        try {
            return CODEC.encode(s.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            // shouldn't happen
            return null;
        }
    }
1263541
public static String encode(Byte[] in) {
		byte[] tmp = new byte[in.length];
		for(int i = 0; i < tmp.length; i++) {
			tmp[i] = in[i];
		}
		return encode(tmp);
	}
978627
public function encode($string)
    {
        // Type validation
        if (is_string($string) === false) {
            throw new InvalidArgumentException('Argument $string must be a string.');
        }

        // If the string is empty, then the encoded string is obviously empty
        if (strlen($string) === 0) {
            return '';
        }

        // Strings in PHP are essentially 8-bit byte arrays
        // so lets convert the string into a PHP array
        $bytes = array_values(unpack('C*', $string));

        // Now we need to convert the byte array into an arbitrary-precision decimal
        // We basically do this by performing a base256 to base10 conversion
        $decimal = $bytes[0];

        for ($i = 1, $l = count($bytes); $i < $l; $i++) {
            $decimal = bcmul($decimal, 256);
            $decimal = bcadd($decimal, $bytes[$i]);
        }

        // This loop now performs base 10 to base 58 conversion
        // The remainder or modulo on each loop becomes a base 58 character
        $output = '';
        while ($decimal >= $this->base) {
            $div = bcdiv($decimal, $this->base, 0);
            $mod = bcmod($decimal, $this->base);
            $output .= $this->alphabet[$mod];
            $decimal = $div;
        }

        // If there's still a remainder, append it
        if ($decimal > 0) {
            $output .= $this->alphabet[$decimal];
        }

        // Now we need to reverse the encoded data
        $output = strrev($output);

        // Now we need to add leading zeros
        foreach ($bytes as $byte) {
            if ($byte === 0) {
                $output = $this->alphabet[0] . $output;
                continue;
            }
            break;
        }

        return (string) $output;
    }
754024
public static String encode(String s) {
        if (s == null) {
            return null;
        }

        StringBuilder builder = null;
        int begin = 0;

        for (int i = 0, length = s.length(); i < length; i++) {
            char ch = s.charAt(i);

            // RFC 2396, Section 3.3.  See also:
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5063160
            switch (ch) {
                // lowalpha
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':
                    // upalpha
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                    // digit
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    // mark
                case '-':
                case '_':
                case '.':
                case '!':
                case '~':
                case '*':
                case '\'':
                case '(':
                case ')':
                    // path_segments
                case '/':
                    // segment
                case ';':
                    // pchar
                case ':':
                case '@':
                case '&':
                case '=':
                case '+':
                case '$':
                case ',':
                    break;

                default:
                    if (builder == null) {
                        builder = new StringBuilder();
                    }

                    builder.append(s, begin, i);
                    begin = i + 1;

                    // Reserved characters are encoded in java.io.DataInput's
                    // "modified UTF-8" format.
                    if (ch <= 0x7f) {
                        appendURLEscapeEncoding(builder, ch);
                    } else if (ch <= 0x7ff) {
                        appendURLEscapeEncoding(builder, 0xc0 | (ch >> 6));
                        appendURLEscapeEncoding(builder, 0x80 | (ch & 0x3f));
                    } else {
                        appendURLEscapeEncoding(builder, 0xe0 | (ch >> 12));
                        appendURLEscapeEncoding(builder, 0x80 | ((ch >> 6) & 0x3f));
                        appendURLEscapeEncoding(builder, 0x80 | (ch & 0x3f));
                    }
                    break;
            }
        }

        if (builder != null) {
            return builder.append(s, begin, s.length()).toString();
        }

        return s;
    }
112578
public String encodeValue()
	{
		switch (function)
		{
			case EQ:
				if (value != null && value.startsWith("_"))
					return function.getPrefix() + value;
				else
					return value;
			default:
				if (function.hasBinaryParam())
					return function.getPrefix() + value + ".." + value2;
				else if (function.hasParam())
					return function.getPrefix() + value;
				else
					return function.getPrefix();
		}
	}
805133
function encodeString(string) {
	//it actually accepts any kind of object as input
	if (string === null) {
		return values.NULL;
	} else if (string === "") {
		return values.EMPTY;
	} else {//0 false undefined NaN will pass from here
		return encodeURIComponent(string)
		.replace(/%20/g, "+");
	}
}
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();
  }