URIUtil.java :  » Scripting » tinyappserver » cn » aprilsoft » http » Java Open Source

Java Open Source » Scripting » tinyappserver 
tinyappserver » cn » aprilsoft » http » URIUtil.java
package cn.aprilsoft.http;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class URIUtil {

    public static String encodeURI(String encoding, String uri) {
        try {
            return URLEncoder.encode(uri, encoding);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

    public static String decodeURI(String encoding, String uri) {
        try {
            return URLDecoder.decode(uri, encoding);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.