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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default InputStreamgetInputStream(String sName)Get theInputStreamspecified by the given name for reading.IReadableResourcegetReadableResource(String sName)Get the resource specified by the given name for reading.booleansupportsReading(String sName)Check if this resource provider can handle the resource with the passed name.
-
-
-
Method Detail
-
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 returntrue.- Parameters:
sName- The name to check. May benull.- Returns:
trueif the name is notnulland can be handled by this provider,falseotherwise.
-
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 theInputStreamspecified by the given name for reading. This method may be called without prior call tosupportsReading(String).- Parameters:
sName- The name of the resource to resolve.- Returns:
- The
InputStream. May benullif the underlying resource does not exist or ifsupportsReading(String)returnsfalse.
-
-