-
//绝对路径 - String
absolutePath = "http://www.sdfsdfsfdf.com/1/2/3.html"; - //相对路径
- String
relativePath = "../../a.jpg"; -
- //以下方法对相对路径进行转换
- URL
absoluteUrl = new URL(absolutePath); -
- URL
parseUrl = new URL(absoluteUrl ,relativePath ); -
- //最终结果
- log.info("相对路径转换后的绝对路径:"
+ parseUrl .toString());
java URL相对路径转换成绝对路径
最新推荐文章于 2021-02-28 15:05:08 发布