Package org.apache.commons.codec.net

Examples of org.apache.commons.codec.net.URLCodec


     * @throws Exception
     */
    public static String encode(String pString, String charset) throws Exception {
      URLcodecTK.checkNull(pString);
      URLcodecTK.checkNull(charset);
      URLCodec url = new URLCodec();
      return url.encode(pString, charset);
    }
View Full Code Here


     * @throws Exception
     * @throws �p�G�ѽX���ѡA�h�ߥXCodeBaseException.
     */
    public static byte[] decode(byte[] URLData) throws Exception {
      URLcodecTK.checkNull(URLData);
      URLCodec url = new URLCodec();
        return url.decode(URLData);
    }
View Full Code Here

     * @return �^�ǽs�X�ᤧ�r��.
     * @throws Exception
     */
    public static String decode(String URLData) throws Exception {
      URLcodecTK.checkNull(URLData);
      URLCodec url = new URLCodec();
        return url.decode(URLData);
    }
View Full Code Here

     * @throws Exception
     */
    public static String decode(String URLData, String charset) throws Exception {
      URLcodecTK.checkNull(URLData);
      URLcodecTK.checkNull(charset);
      URLCodec url = new URLCodec();
      return url.decode(URLData, charset);
    }
View Full Code Here

    }
   
   
    public static String getURLDefaultCharset() {
      URLCodec url = new URLCodec();
      return url.getDefaultCharset();
    }
View Full Code Here

        }
        return converted;
    }

    private static String encode(String object) {
        URLCodec codec = new URLCodec();
        try {
            return codec.encode(object).replaceAll("\\+", "%20");
        }
        catch(EncoderException ee) {
            return object;
        }
    }
View Full Code Here

        }
        return hdr.getValue();
    }

    protected static String decode(String uri) {
        URLCodec codec = new URLCodec();
        try {
            return codec.decode(uri);
        }
        catch(DecoderException ee) {
            return uri;
        }
    }
View Full Code Here

    private static String encode(String name) {
        return encode(name, false);
    }

    private static String encode(String object, boolean preserveslashes) {
        URLCodec codec = new URLCodec();
        try {
            final String encoded = codec.encode(object).replaceAll("\\+", "%20");
            if(preserveslashes) {
                return encoded.replaceAll("%2F", "/");
            }
            return encoded;
        }
View Full Code Here

     private static String doFormUrlEncode(NameValuePair[] pairs, String charset)
        throws UnsupportedEncodingException
     {
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < pairs.length; i++) {
            URLCodec codec = new URLCodec();
            NameValuePair pair = pairs[i];
            if (pair.getName() != null) {
                if (i > 0) {
                    buf.append("&");
                }
                buf.append(codec.encode(pair.getName(), charset));
                buf.append("=");
                if (pair.getValue() != null) {
                    buf.append(codec.encode(pair.getValue(), charset));
                }
            }
        }
        return buf.toString();
    }
View Full Code Here

    }
  }

  // Decode www-form-url
  private static String decodeUrlCodec(final String decodeText) {
    final URLCodec codec = new URLCodec();
    try {
      return codec.decode(decodeText, "UTF-8");
    } catch (final DecoderException e) {
      return "Error: www-form-urlencoded value cannot be decoded...";
    } catch (final UnsupportedEncodingException e) {
      return "Error: www-form-urlencoded value cannot be decoded...";
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.codec.net.URLCodec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.