Class UriWrapper

java.lang.Object
nva.commons.core.paths.UriWrapper

public class UriWrapper extends Object
Class for easily building and manipulating URIs. Tools to easily append paths and not have to deal with checking whether the path delimiter is present or not.
  • Field Details

  • Constructor Details

    • UriWrapper

      @Deprecated(forRemoval=true) public UriWrapper(URI uri)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • UriWrapper

      @Deprecated(forRemoval=true) public UriWrapper(String uri)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the static call fromUri(String) instead.
      Utility for working with URIs in a consistent manner.
      Parameters:
      uri - the URI string
    • UriWrapper

      public UriWrapper(String scheme, String host)
  • Method Details

    • fromUri

      public static UriWrapper fromUri(URI uri)
    • fromUri

      public static UriWrapper fromUri(String uri)
    • fromHost

      public static UriWrapper fromHost(String host)
    • fromHost

      public static UriWrapper fromHost(String host, int port)
    • getUri

      public URI getUri()
    • getHost

      public UriWrapper getHost()
    • addChild

      public UriWrapper addChild(String... path)
    • addChild

      public UriWrapper addChild(UnixPath childPath)
      Appends a path to the URI.
      Parameters:
      childPath - the path to be appended.
      Returns:
      a UriWrapper containing the whole path.
    • replacePathElementByIndexFromEnd

      public UriWrapper replacePathElementByIndexFromEnd(int index, String replacement)
    • toS3bucketPath

      public UnixPath toS3bucketPath()
    • getPath

      public UnixPath getPath()
    • getParent

      public Optional<UriWrapper> getParent()
    • getLastPathElement

      public String getLastPathElement()
    • getFilename

      @Deprecated(since="getLastPathElement was introduced") public String getFilename()
      Deprecated.
      User getLastPathElement
      Returns the last element from the URI path.
      Returns:
      element.
    • addQueryParameter

      public UriWrapper addQueryParameter(String param, String value)
    • addQueryParameters

      public UriWrapper addQueryParameters(Map<String,String> parameters)
    • toString

      public String toString()
      Overrides:
      toString in class Object