Class UtilURL


  • public final class UtilURL
    extends java.lang.Object
    URL Utilities - Simple Class for flexibly working with properties files
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String module  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <C> java.net.URL fromClass​(java.lang.Class<C> contextClass)  
      static java.net.URL fromFilename​(java.lang.String filename)  
      static java.net.URL fromOfbizHomePath​(java.lang.String filename)  
      static <C> java.net.URL fromResource​(java.lang.Class<C> contextClass, java.lang.String resourceName)  
      static java.net.URL fromResource​(java.lang.String resourceName)
      Returns a URL instance from a resource name.
      static java.net.URL fromResource​(java.lang.String resourceName, java.lang.ClassLoader loader)
      Returns a URL instance from a resource name.
      static java.net.URL fromUrlString​(java.lang.String urlString)  
      static java.lang.String getOfbizHomeRelativeLocation​(java.net.URL fileUrl)  
      • Methods inherited from class java.lang.Object

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

      • module

        public static final java.lang.String module
    • Method Detail

      • fromClass

        public static <C> java.net.URL fromClass​(java.lang.Class<C> contextClass)
      • fromResource

        public static java.net.URL fromResource​(java.lang.String resourceName)
        Returns a URL instance from a resource name. Returns null if the resource is not found.

        This method uses various ways to locate the resource, and in all cases it tests to see if the resource exists - so it is very inefficient.

        Parameters:
        resourceName -
        Returns:
      • fromResource

        public static <C> java.net.URL fromResource​(java.lang.Class<C> contextClass,
                                                    java.lang.String resourceName)
      • fromResource

        public static java.net.URL fromResource​(java.lang.String resourceName,
                                                java.lang.ClassLoader loader)
        Returns a URL instance from a resource name. Returns null if the resource is not found.

        This method uses various ways to locate the resource, and in all cases it tests to see if the resource exists - so it is very inefficient.

        Parameters:
        resourceName -
        loader -
        Returns:
      • fromFilename

        public static java.net.URL fromFilename​(java.lang.String filename)
      • fromUrlString

        public static java.net.URL fromUrlString​(java.lang.String urlString)
      • fromOfbizHomePath

        public static java.net.URL fromOfbizHomePath​(java.lang.String filename)
      • getOfbizHomeRelativeLocation

        public static java.lang.String getOfbizHomeRelativeLocation​(java.net.URL fileUrl)