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,前面带'/'
path = path-abempty / path-absolute / path-noscheme / path-rootless / path-empty |
String |
build(Charset charset,
boolean encodePercent)
构建path,前面带'/'
path = path-abempty / path-absolute / path-noscheme / path-rootless / path-empty |
String |
getSegment(int index)
获得指定节点
|
List<String> |
getSegments()
获取path的节点列表
|
static UrlPath |
of(CharSequence pathStr,
Charset charset)
构建UrlPath
|
UrlPath |
parse(CharSequence path,
Charset charset)
解析path
|
UrlPath |
setWithEndTag(boolean withEngTag)
是否path的末尾加 /
|
String |
toString() |
public static UrlPath of(CharSequence 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(CharSequence path, Charset charset)
path
- 路径,类似于aaa/bb/ccc或/aaa/bbb/ccccharset
- decode编码,null表示不解码public String build(Charset charset)
path = path-abempty / path-absolute / path-noscheme / path-rootless / path-empty
charset
- encode编码,null表示不做encodepublic String build(Charset charset, boolean encodePercent)
path = path-abempty / path-absolute / path-noscheme / path-rootless / path-empty
charset
- encode编码,null表示不做encodeencodePercent
- 是否编码`%`Copyright © 2024. All rights reserved.