public class UrlPath extends Object
Constructor and Description |
---|
UrlPath() |
Modifier and Type | Method and Description |
---|---|
UrlPath |
add(CharSequence segment)
添加到path最后面
|
UrlPath |
addBefore(CharSequence segment)
添加到path最前面
|
String |
build(Charset charset)
构建path,前面带'/'
|
String |
getSegment(int index)
获得指定节点
|
List<String> |
getSegments()
获取path的节点列表
|
static UrlPath |
of(String pathStr,
Charset charset)
构建UrlPath
|
UrlPath |
parse(String path,
Charset charset)
解析path
|
UrlPath |
setWithEndTag(boolean withEngTag)
是否path的末尾加 /
|
String |
toString() |
public static UrlPath of(String pathStr, Charset charset)
pathStr
- 初始化的路径字符串charset
- decode用的编码,null表示不做decodepublic UrlPath setWithEndTag(boolean withEngTag)
withEngTag
- 是否path的末尾加 /public String getSegment(int index)
index
- 节点位置public UrlPath add(CharSequence segment)
segment
- Path节点public UrlPath addBefore(CharSequence segment)
segment
- Path节点public UrlPath parse(String path, Charset charset)
path
- 路径,类似于aaa/bb/ccc或/aaa/bbb/ccccharset
- decode编码,null表示不解码public String build(Charset charset)
charset
- encode编码,null表示不做encodeCopyright © 2021. All rights reserved.