Class FileSystemResourceProvider
- java.lang.Object
-
- com.helger.commons.io.resourceprovider.FileSystemResourceProvider
-
- All Implemented Interfaces:
IReadableResourceProvider,IWritableResourceProvider
@ThreadSafe public class FileSystemResourceProvider extends Object implements IWritableResourceProvider
Simple resource provider that only uses files.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description FileSystemResourceProvider()FileSystemResourceProvider(File aBasePath)FileSystemResourceProvider(String sBasePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)FilegetBasePath()IReadableResourcegetReadableResource(String sName)Get the resource specified by the given name for reading.IWritableResourcegetWritableResource(String sName)Get the resource specified by the given name for writing.inthashCode()booleanisCanReadRelativePaths()FileSystemResourceProvidersetCanReadRelativePaths(boolean bCanReadRelativePaths)booleansupportsReading(String sName)Check if this resource provider can handle the resource with the passed name.booleansupportsWriting(String sName)Check if this resource provider can handle the resource with the passed name.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.io.resourceprovider.IReadableResourceProvider
getInputStream
-
Methods inherited from interface com.helger.commons.io.resourceprovider.IWritableResourceProvider
getOutputStream
-
-
-
-
Method Detail
-
isCanReadRelativePaths
public final boolean isCanReadRelativePaths()
-
setCanReadRelativePaths
@Nonnull public final FileSystemResourceProvider setCanReadRelativePaths(boolean bCanReadRelativePaths)
-
supportsReading
public boolean supportsReading(@Nullable String sName)
Description copied from interface:IReadableResourceProviderCheck 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.
-
supportsWriting
public boolean supportsWriting(@Nullable String sName)
Description copied from interface:IWritableResourceProviderCheck 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:
supportsWritingin interfaceIWritableResourceProvider- Parameters:
sName- The name to check. May benull.- Returns:
trueif the name is notnulland can be handled by this provider,falseotherwise.
-
getReadableResource
@Nonnull public IReadableResource getReadableResource(@Nonnull String sName)
Description copied from interface:IReadableResourceProviderGet 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.
-
getWritableResource
@Nonnull public IWritableResource getWritableResource(@Nonnull String sName)
Description copied from interface:IWritableResourceProviderGet the resource specified by the given name for writing.- Specified by:
getWritableResourcein interfaceIWritableResourceProvider- Parameters:
sName- The name of the resource to resolve.- Returns:
- The writable resource. Never
null.
-
-