Class StreamableClassPathResource

java.lang.Object
org.apache.creadur.whisker.app.StreamableResource
org.apache.creadur.whisker.app.load.StreamableClassPathResource

public final class StreamableClassPathResource extends StreamableResource
Streams, on demand, the contents of a resource located on the class path.
  • Constructor Details

    • StreamableClassPathResource

      public StreamableClassPathResource(String name)
      Constructs an instance that streams the given class path resource on demand.
      Parameters:
      name - full name including path of a resource on the class path, not null
  • Method Details

    • getName

      public String getName()
      Gets the location on the class path of the resource to be streamed.
      Returns:
      not null
    • exists

      public boolean exists()
      Is this resource found on the classpath?
      Returns:
      true when the resource is found on the classpath, null otherwise
    • open

      public InputStream open() throws IOException
      Opens a resource on the classpath.
      Specified by:
      open in class StreamableResource
      Returns:
      not null
      Throws:
      IOException - when resource cannot be open
      See Also:
    • toString

      public String toString()
      Suitable for logging.
      Overrides:
      toString in class Object
      Returns:
      a description