Class UriWrapper


  • public class UriWrapper
    extends java.lang.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 Detail

      • EMPTY_FRAGMENT

        public static final java.lang.String EMPTY_FRAGMENT
      • EMPTY_PATH

        public static final java.lang.String EMPTY_PATH
      • EMPTY_USER_INFO

        public static final java.lang.String EMPTY_USER_INFO
      • EMPTY_QUERY

        public static final java.lang.String EMPTY_QUERY
      • NULL_INPUT_ERROR

        public static final java.lang.String NULL_INPUT_ERROR
        See Also:
        Constant Field Values
    • Constructor Detail

      • UriWrapper

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

        @Deprecated(forRemoval=true)
        public UriWrapper​(java.lang.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​(java.lang.String scheme,
                          java.lang.String host)
    • Method Detail

      • fromUri

        public static UriWrapper fromUri​(java.net.URI uri)
      • fromUri

        public static UriWrapper fromUri​(java.lang.String uri)
      • fromHost

        public static UriWrapper fromHost​(java.lang.String host)
      • fromHost

        public static UriWrapper fromHost​(java.lang.String host,
                                          int port)
      • getUri

        public java.net.URI getUri()
      • addChild

        public UriWrapper addChild​(java.lang.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.
      • toS3bucketPath

        public UnixPath toS3bucketPath()
      • getParent

        public java.util.Optional<UriWrapper> getParent()
      • getLastPathElement

        public java.lang.String getLastPathElement()
      • getFilename

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

        public UriWrapper addQueryParameter​(java.lang.String param,
                                            java.lang.String value)
      • addQueryParameters

        public UriWrapper addQueryParameters​(java.util.Map<java.lang.String,​java.lang.String> parameters)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object