java encodeuri工具类_URLUtil 工具类

URLUtil 工具类

(2011-05-13 16:56:16)

说明: 此类来自javaEye文章,自己收藏了.

package test;

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.io.UnsupportedEncodingException;

import java.net.HttpURLConnection;

import java.net.URL;

import java.net.URLConnection;

import java.net.URLDecoder;

import java.net.URLEncoder;

import java.util.Iterator;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

public class URLUtil {

public static String encodeURL(String url) {

try {

return URLEncoder.encode(url, "UTF-8");

} catch (UnsupportedEncodingException e) {

e.printStackTrace();

return null;

}

}

public static String decodeURL(String url){

try {

return UR

你可能感兴趣的:(java,encodeuri工具类)