public class URLResourceKits extends Object
copy from vipshop VJTools(com.vip.vjtools.vjkit.io.ResourceUtil) and made some changes.
| 构造器和说明 |
|---|
URLResourceKits() |
| 限定符和类型 | 方法和说明 |
|---|---|
static File |
asFile(String generalPath)
兼容无前缀, classpath:, file:// 的情况获取文件
如果以classpath: 定义的文件不存在会抛出IllegalArgumentException异常,以file://定义的则不会
|
static InputStream |
asStream(String generalPath)
兼容无前缀, classpath:, file:// 的情况打开文件成Stream
|
static URI |
toURI(String location)
toURI
|
public static File asFile(String generalPath) throws IOException
如果以classpath: 定义的文件不存在会抛出IllegalArgumentException异常,以file://定义的则不会
generalPath - IOExceptionpublic static InputStream asStream(String generalPath) throws IOException
generalPath - IOExceptionpublic static URI toURI(String location) throws URISyntaxException
location - URISyntaxExceptionCopyright © 2019. All rights reserved.