Class ClasspathLocator

  • All Implemented Interfaces:
    ResourceLocator

    public class ClasspathLocator
    extends java.lang.Object
    implements ResourceLocator
    A resource locator that finds resources on the classpath
    • Field Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream open​(java.lang.String searchLocation, java.lang.String filename)
      Opens a search location, potentially applying some resolution rules to that location
      • Methods inherited from class java.lang.Object

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

      • CLASSPATH_URI_PREFIX

        public static final java.lang.String CLASSPATH_URI_PREFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • ClasspathLocator

        public ClasspathLocator()
    • Method Detail

      • open

        public java.io.InputStream open​(java.lang.String searchLocation,
                                        java.lang.String filename)
                                 throws java.io.IOException
        Description copied from interface: ResourceLocator
        Opens a search location, potentially applying some resolution rules to that location

        If the given resourceName exists in the search location then that resource should be returned. If that is not a valid resource but the search location itself is a valid resource then the locator should return that instead.

        Specified by:
        open in interface ResourceLocator
        Parameters:
        searchLocation - Search location
        filename - Resource name expected in the search location
        Returns:
        Input stream to read the search location or null if not a valid location
        Throws:
        java.io.IOException - Thrown if there is a problem accessing the search location