Package com.helger.io.resourceprovider
Class ReadableResourceProviderChain
java.lang.Object
com.helger.io.resourceprovider.ReadableResourceProviderChain
- All Implemented Interfaces:
IReadableResourceProvider
- Direct Known Subclasses:
WritableResourceProviderChain
@Immutable
public class ReadableResourceProviderChain
extends Object
implements IReadableResourceProvider
A readable resource provider that chains multiple
IReadableResourceProvider.- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionReadableResourceProviderChain(@NonNull IReadableResourceProvider... aResProviders) Constructor with a varargs array of resource providers.ReadableResourceProviderChain(@NonNull Iterable<? extends IReadableResourceProvider> aResProviders) Constructor with an iterable of resource providers. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal @NonNull com.helger.collection.commons.ICommonsList<IReadableResourceProvider> @Nullable InputStreamgetInputStream(@NonNull String sName) Get theInputStreamspecified by the given name for reading.@NonNull IReadableResourcegetReadableResource(@NonNull String sName) Get the resource specified by the given name for reading.@Nullable IReadableResourcegetReadableResourceIf(@NonNull String sName, @NonNull Predicate<? super IReadableResource> aReturnFilter) Get a readable resource matching the name and filter.inthashCode()protected final @NonNull com.helger.collection.commons.ICommonsList<IReadableResourceProvider> final booleansupportsReading(@Nullable String sName) Check if this resource provider can handle the resource with the passed name.toString()
-
Constructor Details
-
ReadableResourceProviderChain
Constructor with a varargs array of resource providers.- Parameters:
aResProviders- The resource providers to use. May neither benullnor empty and may not containnullelements.
-
ReadableResourceProviderChain
public ReadableResourceProviderChain(@NonNull Iterable<? extends IReadableResourceProvider> aResProviders) Constructor with an iterable of resource providers.- Parameters:
aResProviders- The resource providers to use. May neither benullnor empty and may not containnullelements.
-
-
Method Details
-
readingResourceProviders
@ReturnsMutableObject protected final @NonNull com.helger.collection.commons.ICommonsList<IReadableResourceProvider> readingResourceProviders() -
getAllContainedReadingResourceProviders
@ReturnsMutableCopy public final @NonNull com.helger.collection.commons.ICommonsList<IReadableResourceProvider> getAllContainedReadingResourceProviders()- Returns:
- A copy of all contained reading resource providers. Never
null.
-
supportsReading
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.- Specified by:
supportsReadingin interfaceIReadableResourceProvider- Parameters:
sName- The name to check. May benull.- Returns:
trueif the name is notnulland can be handled by this provider,falseotherwise.
-
getReadableResource
Get the resource specified by the given name for reading.- Specified by:
getReadableResourcein interfaceIReadableResourceProvider- Parameters:
sName- The name of the resource to resolve.- Returns:
- The readable resource. Never
null.
-
getReadableResourceIf
public @Nullable IReadableResource getReadableResourceIf(@NonNull String sName, @NonNull Predicate<? super IReadableResource> aReturnFilter) Get a readable resource matching the name and filter.- Parameters:
sName- The name of the resource to resolve. May not benull.aReturnFilter- The filter to apply on found resources. May not benull.- Returns:
nullif no matching resource was found.
-
getInputStream
Description copied from interface:IReadableResourceProviderGet theInputStreamspecified by the given name for reading. This method may be called without prior call toIReadableResourceProvider.supportsReading(String).- Specified by:
getInputStreamin interfaceIReadableResourceProvider- Parameters:
sName- The name of the resource to resolve.- Returns:
- The
InputStream. May benullif the underlying resource does not exist or ifIReadableResourceProvider.supportsReading(String)returnsfalse.
-
equals
-
hashCode
public int hashCode() -
toString
-