Class DefaultResourceManager

java.lang.Object
cloud.piranha.resource.DefaultResourceManager
All Implemented Interfaces:
ResourceManager

public class DefaultResourceManager
extends java.lang.Object
implements ResourceManager
The default ResourceManager.
Author:
Manfred Riem ([email protected])
  • Constructor Summary

    Constructors 
    Constructor Description
    DefaultResourceManager()  
  • Method Summary

    Modifier and Type Method Description
    void addResource​(Resource resource)
    Add resource.
    java.util.stream.Stream<java.lang.String> getAllLocations()
    Get all the locations for this resource manager.
    java.net.URL getResource​(java.lang.String location)
    Get the resource URL.
    java.io.InputStream getResourceAsStream​(java.lang.String location)
    Get the resource as a stream.
    java.util.Collection<java.net.URL> getResources​(java.lang.String location)
    Get the resources.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • addResource

      public void addResource​(Resource resource)
      Add resource.
      Specified by:
      addResource in interface ResourceManager
      Parameters:
      resource - the resource.
    • getResource

      public java.net.URL getResource​(java.lang.String location) throws java.net.MalformedURLException
      Get the resource URL.
      Specified by:
      getResource in interface ResourceManager
      Parameters:
      location - the location.
      Returns:
      the URL, or null if not found.
      Throws:
      java.net.MalformedURLException - when the location URL is malformed.
    • getResources

      public java.util.Collection<java.net.URL> getResources​(java.lang.String location) throws java.net.MalformedURLException
      Get the resources.
      Specified by:
      getResources in interface ResourceManager
      Parameters:
      location - the location.
      Returns:
      the collection with the resources.
      Throws:
      java.net.MalformedURLException - when the location URL is malformed.
    • getResourceAsStream

      public java.io.InputStream getResourceAsStream​(java.lang.String location)
      Get the resource as a stream.
      Specified by:
      getResourceAsStream in interface ResourceManager
      Parameters:
      location - the location.
      Returns:
      the input stream, or null if not found.
    • getAllLocations

      public java.util.stream.Stream<java.lang.String> getAllLocations()
      Description copied from interface: ResourceManager
      Get all the locations for this resource manager.
      Specified by:
      getAllLocations in interface ResourceManager
      Returns:
      all the locations for this resource manager.