Class StreamableResourceFactory

java.lang.Object
org.apache.creadur.whisker.app.load.StreamableResourceFactory

public final class StreamableResourceFactory extends Object
Conveniently builds StreamableResource implementations.
  • Constructor Details

    • StreamableResourceFactory

      public StreamableResourceFactory()
  • Method Details

    • streamFromClassPathResource

      public StreamableResource streamFromClassPathResource(String name)
      Builds instance that streams, on demand, from resource on the class path.
      Parameters:
      name - full name, including path, of the resource not null
      Returns:
      an instance that streams, on demand, the given resource, not null
    • streamFromFileResource

      public StreamableResource streamFromFileResource(String fileName)
      Builds instance that streams, on demand, from resource stored in the file system.
      Parameters:
      fileName - full name, including path, of the resource not null
      Returns:
      an instance that streams, on demand, the given resource, not null
    • streamFromFileResource

      public StreamableResource streamFromFileResource(File file)
      Builds instance that streams, on demand, from resource stored in the file system.
      Parameters:
      file - a file storing the resource not null
      Returns:
      an instance that streams, on demand, the given resource, not null
    • streamFromResource

      public StreamableResource streamFromResource(String resourceName)
      When the resource is found on the classpath, builds an instance that streams, on demand, from the classpath. Otherwise, builds an instances that streams from the file system.
      Parameters:
      resourceName - source stream name.
      Returns:
      not null