Class Utility


  • public class Utility
    extends Object
    Utility class.
    Author:
    mcayanan
    • Constructor Detail

      • Utility

        public Utility()
    • Method Detail

      • getValidationTarget

        public static ValidationTarget getValidationTarget​(URL target)
        Returns a ValidationTarget for the specified target URL. If a cached target already exists in the cache, then that is returned, otherwise a new ValidationTarget is returned.
      • openConnection

        public static InputStream openConnection​(URLConnection conn)
                                          throws IOException
        Method that opens a connection. Supports redirects.
        Parameters:
        conn - URL Connection
        Returns:
        input stream.
        Throws:
        IOException - If an error occurred while opening the stream.
      • isDir

        public static boolean isDir​(String url)
      • isDir

        public static boolean isDir​(URL url)
      • getParent

        public static URL getParent​(URL url)
      • canRead

        public static boolean canRead​(URL url)
      • canRead

        public static boolean canRead​(String url)
      • removeLastSlash

        public static String removeLastSlash​(String url)
      • supportXincludes

        public static boolean supportXincludes()
        Convenience method for disabling xinclude support throughout the core library.
        Returns:
      • fixSlashes

        public static String fixSlashes​(String sysid)
        Replace backslashes with forward slashes. (URLs always use forward slashes.)
        Parameters:
        sysid - The input system identifier.
        Returns:
        The same system identifier with backslashes turned into forward slashes.
      • makeAbsolute

        public static String makeAbsolute​(String base,
                                          String sysid)
                                   throws MalformedURLException
        Construct an absolute URI from a relative one, using the current base URI.
        Parameters:
        sysid - The (possibly relative) system identifier
        Returns:
        The system identifier made absolute with respect to the current #base.
        Throws:
        MalformedURLException
      • getTargetType

        public static TargetType getTargetType​(URL url)
      • getTargetType

        public static TargetType getTargetType​(URL source,
                                               URL label)