Package org.miaixz.bus.core.net.url
Class UrlPath
java.lang.Object
org.miaixz.bus.core.net.url.UrlPath
URL中Path部分的封装
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(CharSequence segment) 添加到path最后面addBefore(CharSequence segment) 添加到path最前面构建path,前面带'/'getSegment(int index) 获得指定节点获取path的节点列表,如果列表为空,返回ListKit.empty()static UrlPathof()构建UrlPathstatic UrlPathof(CharSequence pathStr, Charset charset) 构建UrlPathparse(CharSequence path, Charset charset) 解析pathsetWithEndTag(boolean withEngTag) 是否path的末尾加 /toString()
-
Constructor Details
-
UrlPath
public UrlPath()
-
-
Method Details
-
of
构建UrlPath- Returns:
- UrlPath
-
of
构建UrlPath- Parameters:
pathStr- 初始化的路径字符串charset- decode用的编码,null表示不做decode- Returns:
- UrlPath
-
setWithEndTag
是否path的末尾加 /- Parameters:
withEngTag- 是否path的末尾加 /- Returns:
- this
-
getSegments
获取path的节点列表,如果列表为空,返回ListKit.empty()- Returns:
- 节点列表
-
getSegment
获得指定节点- Parameters:
index- 节点位置- Returns:
- 节点,无节点或者越界返回null
-
add
添加到path最后面- Parameters:
segment- Path节点- Returns:
- this
-
addBefore
添加到path最前面- Parameters:
segment- Path节点- Returns:
- this
-
parse
解析path- Parameters:
path- 路径,类似于aaa/bb/ccc或/aaa/bbb/ccccharset- decode编码,null表示不解码- Returns:
- this
-
build
构建path,前面带'/'path = path-abempty / path-absolute / path-noscheme / path-rootless / path-empty- Parameters:
charset- encode编码,null表示不做encode- Returns:
- 如果没有任何内容,则返回空字符串""
-
toString
-