Class UriKit.Path

java.lang.Object
org.aoju.bus.core.toolkit.UriKit.Path
Enclosing class:
UriKit

public static class UriKit.Path extends Object
URL中Path部分的封装
  • Constructor Details

    • Path

      public Path()
  • Method Details

    • of

      public static UriKit.Path of(String pathStr, Charset charset)
      构建Path
      Parameters:
      pathStr - 初始化的路径字符串
      charset - decode用的编码,null表示不做decode
      Returns:
      UriKit.Path
    • setWithEndTag

      public UriKit.Path setWithEndTag(boolean withEngTag)
      是否path的末尾加/
      Parameters:
      withEngTag - 是否path的末尾加/
      Returns:
      this
    • getSegments

      public List<String> getSegments()
      获取path的节点列表
      Returns:
      节点列表
    • getSegment

      public String getSegment(int index)
      获得指定节点
      Parameters:
      index - 节点位置
      Returns:
      节点,无节点或者越界返回null
    • add

      public UriKit.Path add(CharSequence segment)
      添加到path最后面
      Parameters:
      segment - Path节点
      Returns:
      this
    • addBefore

      public UriKit.Path addBefore(CharSequence segment)
      添加到path最前面
      Parameters:
      segment - Path节点
      Returns:
      this
    • parse

      public UriKit.Path parse(String path, Charset charset)
      解析path
      Parameters:
      path - 路径,类似于aaa/bb/ccc
      charset - decode编码,null表示不解码
      Returns:
      this
    • build

      public String build(Charset charset)
      构建path,前面带'/'
      Parameters:
      charset - encode编码,null表示不做encode
      Returns:
      如果没有任何内容,则返回空字符串""
    • toString

      public String toString()
      Overrides:
      toString in class Object