Class CharsetConvert


  • public class CharsetConvert
    extends Object
    字符编码转换器
    Author:
    xianmao.hexm 2007-3-5 09:51:33
    • Constructor Detail

      • CharsetConvert

        public CharsetConvert​(String clientEncoding,
                              String serverEncoding)
    • 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