Class CharsetConvert
- java.lang.Object
-
- com.alibaba.druid.filter.encoding.CharsetConvert
-
public class CharsetConvert extends Object
字符编码转换器- Author:
- xianmao.hexm 2007-3-5 09:51:33
-
-
Constructor Summary
Constructors Constructor Description CharsetConvert(String clientEncoding, String serverEncoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdecode(String s)Decodes the specified string using the specified server and client encodings, if enabled.Stringencode(String s)Encodes the specified string using the specified client and server encodings, if enabled.booleanisEmpty(String s)Determines whether the specified string is null or empty.
-
-
-
Method Detail
-
encode
public String encode(String s) throws UnsupportedEncodingException
Encodes the specified string using the specified client and server encodings, if enabled. If encoding is not enabled or the input string is empty, the original string is returned unchanged.- Parameters:
s- the string to be encoded- Returns:
- the encoded string, or the original string if encoding is not enabled or the input string is empty
- Throws:
UnsupportedEncodingException- if the specified encoding is not supported
-
decode
public String decode(String s) throws UnsupportedEncodingException
Decodes the specified string using the specified server and client encodings, if enabled. If decoding is not enabled or the input string is empty, the original string is returned unchanged.- Parameters:
s- the string to be decoded- Returns:
- the decoded string, or the original string if decoding is not enabled or the input string is empty
- Throws:
UnsupportedEncodingException- if the specified encoding is not supported
-
isEmpty
public boolean isEmpty(String s)
Determines whether the specified string is null or empty.- Parameters:
s- the string to be checked- Returns:
- true if the specified string is null or empty, false otherwise
-
-