Class ResourceURL


  • public abstract class ResourceURL
    extends java.lang.Object
    Factory class that can be used to construct a URL for a given Resource. The URLs returned from this class can be used to access file content using the URL.openStream() method, however, the URL cannot be serialized. URLs can be used with a URLClassLoader.
    • Field Summary

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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.net.URL get​(Resource resource)
      Get a URL for the given Resource.
      static java.net.URL get​(Resource resource, boolean nonLocking)
      Get a URL for the given Resource.
      static java.util.List<java.net.URL> getForResources​(java.lang.Iterable<? extends Resource> resources)
      Get a List of URLs for the given Resources.
      static java.util.List<java.net.URL> getForResources​(java.lang.Iterable<? extends Resource> resources, boolean nonLocking)
      Get a List of URLs for the given Resources.
      • Methods inherited from class java.lang.Object

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

      • get

        public static java.net.URL get​(Resource resource)
                                throws java.net.MalformedURLException
        Get a URL for the given Resource.
        Parameters:
        resource - the resource
        Returns:
        a URL for the resource
        Throws:
        java.net.MalformedURLException
      • get

        public static java.net.URL get​(Resource resource,
                                       boolean nonLocking)
                                throws java.net.MalformedURLException
        Get a URL for the given Resource.
        Parameters:
        resource - the resource
        nonLocking - if the URL should protect against file locking
        Returns:
        a URL for the resource
        Throws:
        java.net.MalformedURLException
      • getForResources

        public static java.util.List<java.net.URL> getForResources​(java.lang.Iterable<? extends Resource> resources)
                                                            throws java.net.MalformedURLException
        Get a List of URLs for the given Resources.
        Returns:
        a list of URLs for the resource
        Throws:
        java.net.MalformedURLException
      • getForResources

        public static java.util.List<java.net.URL> getForResources​(java.lang.Iterable<? extends Resource> resources,
                                                                   boolean nonLocking)
                                                            throws java.net.MalformedURLException
        Get a List of URLs for the given Resources.
        Parameters:
        nonLocking - if the URL should protect against file locking
        Returns:
        a list of URLs for the resource
        Throws:
        java.net.MalformedURLException