Class ClassPathResourceLoader

java.lang.Object
net.targetr.wtm3.io.loader.ClassPathResourceLoader
All Implemented Interfaces:
ResourceLoader

public class ClassPathResourceLoader extends Object implements ResourceLoader
Opens resources from the classpath using Class.getResourceAsStream(String).
  • Constructor Details

    • ClassPathResourceLoader

      public ClassPathResourceLoader()
      Creates a new ClassPathResourceLoader.
  • Method Details

    • openInputStream

      public InputStream openInputStream(String path) throws IOException
      Description copied from interface: ResourceLoader
      Opens a resource stream. The caller is responsible for closing the returned stream.
      Specified by:
      openInputStream in interface ResourceLoader
      Parameters:
      path - the resource path understood by this loader
      Returns:
      a stream containing the resource data, or null if the resource is not found
      Throws:
      IOException - if opening or reading the resource fails
    • getSource

      public String getSource()
      Description copied from interface: ResourceLoader
      Returns the resource source.
      Specified by:
      getSource in interface ResourceLoader
      Returns:
      a string representing the source resources are loaded from