com.xiaoleilu.hutool
类 URLUtil

java.lang.Object
  继承者 com.xiaoleilu.hutool.URLUtil

public class URLUtil
extends Object

统一资源定位符相关工具类

作者:
xiaoleilu

构造方法摘要
URLUtil()
           
 
方法摘要
static String complateUrl(String baseUrl, String relativePath)
          补全相对路径
static String formatUrl(String url)
          格式化URL链接
static URL getURL(File configFile)
          获得URL,常用于使用绝对路径时的情况
static URL getURL(String pathBaseClassLoader)
          获得URL
static URL getURL(String path, Class<?> clazz)
          获得URL
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

URLUtil

public URLUtil()
方法详细信息

getURL

public static URL getURL(String pathBaseClassLoader)
获得URL

参数:
pathBaseClassLoader - 相对路径(相对于classes)
返回:
URL

getURL

public static URL getURL(String path,
                         Class<?> clazz)
获得URL

参数:
path - 相对给定 class所在的路径
clazz - 指定class
返回:
URL

getURL

public static URL getURL(File configFile)
获得URL,常用于使用绝对路径时的情况

参数:
configFile - URL对应的文件对象
返回:
URL

formatUrl

public static String formatUrl(String url)
格式化URL链接

参数:
url - 需要格式化的URL
返回:
格式化后的URL,如果提供了null或者空串,返回null

complateUrl

public static String complateUrl(String baseUrl,
                                 String relativePath)
补全相对路径

参数:
baseUrl - 基准URL
relativePath - 相对URL
返回:
相对路径


Copyright © 2014. All rights reserved.