Class Util


  • public final class Util
    extends java.lang.Object
    TODO: JAX-WS dependes on this class - consider moving it somewhere more stable, Notify JAX-WS before modifying anything... Other miscellaneous utility methods.
    Author:
    Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equal​(java.lang.String s, java.lang.String t)
      determine if two Strings are iqual allowing null values
      static boolean equalsIgnoreCase​(java.lang.String s, java.lang.String t)
      determine if two Strings are equal ignoring case allowing null values
      static java.lang.String escapeURI​(java.lang.String s)
      Escape any characters that would cause the single arg constructor of java.net.URI to complain about illegal chars.
      static java.lang.String getParentUriPath​(java.lang.String uriPath)
      Calculate the parent URI path of the given URI path.
      static java.lang.String normalizeUriPath​(java.lang.String uriPath)
      Calculate the normalized form of the given uriPath.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • escapeURI

        public static java.lang.String escapeURI​(java.lang.String s)
        Escape any characters that would cause the single arg constructor of java.net.URI to complain about illegal chars.
        Parameters:
        s - source string to be escaped
      • getParentUriPath

        public static java.lang.String getParentUriPath​(java.lang.String uriPath)
        Calculate the parent URI path of the given URI path.
        Parameters:
        uriPath - the uriPath (as returned by java.net.URI#getPath()
        Returns:
        the parent URI path of the given URI path
      • normalizeUriPath

        public static java.lang.String normalizeUriPath​(java.lang.String uriPath)
        Calculate the normalized form of the given uriPath.

        For example:

        
            /a/b/c/ -> /a/b/c/
            /a/b/c  -> /a/b/
            /a/     -> /a/
            /a      -> /
            
        Parameters:
        uriPath - path of a URI (as returned by java.net.URI#getPath()
        Returns:
        the normalized uri path
      • equalsIgnoreCase

        public static boolean equalsIgnoreCase​(java.lang.String s,
                                               java.lang.String t)
        determine if two Strings are equal ignoring case allowing null values
        Parameters:
        s - string 1
        t - string 2
        Returns:
        true iff the given strings are equal ignoring case, false if they aren't equal or either of them are null.
      • equal

        public static boolean equal​(java.lang.String s,
                                    java.lang.String t)
        determine if two Strings are iqual allowing null values
        Parameters:
        s - string 1
        t - string 2
        Returns:
        true iff the strings are equal, false if they aren't equal or either of them are null.