Interface IReadableResourceProvider

All Known Subinterfaces:
IWritableResourceProvider
All Known Implementing Classes:
ClassPathResourceProvider, DefaultResourceProvider, FileSystemResourceProvider, ReadableResourceProviderChain, URLResourceProvider, WritableResourceProviderChain

@MustImplementEqualsAndHashcode public interface IReadableResourceProvider
Resource provider interface for readable resources.
Author:
Philip Helger
  • Method Details

    • supportsReading

      boolean supportsReading(@Nullable String sName)
      Check if this resource provider can handle the resource with the passed name. If there is no real check on whether your resource provider can handle it, simply return true.
      Parameters:
      sName - The name to check. May be null.
      Returns:
      true if the name is not null and can be handled by this provider, false otherwise.
    • getReadableResource

      @Nonnull IReadableResource getReadableResource(@Nonnull String sName)
      Get the resource specified by the given name for reading.
      Parameters:
      sName - The name of the resource to resolve.
      Returns:
      The readable resource. Never null.
    • getInputStream

      @Nullable default InputStream getInputStream(@Nonnull String sName)
      Get the InputStream specified by the given name for reading. This method may be called without prior call to supportsReading(String).
      Parameters:
      sName - The name of the resource to resolve.
      Returns:
      The InputStream. May be null if the underlying resource does not exist or if supportsReading(String) returns false.