Class AbstractMemoryReadableResource
- java.lang.Object
-
- com.helger.commons.io.resource.inmemory.AbstractMemoryReadableResource
-
- All Implemented Interfaces:
IHasInputStream,IHasInputStreamAndReader,IMemoryReadableResource,IReadableResource,IResourceBase
- Direct Known Subclasses:
ReadableResourceByteArray,ReadableResourceInputStream
public abstract class AbstractMemoryReadableResource extends Object implements IMemoryReadableResource
Abstract base class for anIReadableResourcethat is not really a resource but where the API does not offer alternatives. These resources cannot be converted to a file or to a URL.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMemoryReadableResource(String sResourceID)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()FilegetAsFile()URLgetAsURL()StringgetPath()IReadableResourcegetReadableCloneForPath(String sPath)Get a new resource of the same implementation type as this object but for a different path.StringgetResourceID()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.io.IHasInputStream
getBufferedInputStream, getInputStream, isReadMultiple
-
Methods inherited from interface com.helger.commons.io.IHasInputStreamAndReader
getBufferedReader, getReader
-
-
-
-
Method Detail
-
getResourceID
@Nonnull @Nonempty public final String getResourceID()
- Specified by:
getResourceIDin interfaceIResourceBase- Returns:
- The resource ID as provided in the constructor. Neither
nullnor empty.
-
getPath
@Nonnull public String getPath()
- Specified by:
getPathin interfaceIResourceBase- Returns:
- The requested path. Never
null
-
getAsURL
@Nullable public URL getAsURL()
- Specified by:
getAsURLin interfaceIResourceBase- Returns:
- the URL representation of this resource. May be
nullif this resource cannot be represented as an URL.
-
getAsFile
@Nullable public File getAsFile()
- Specified by:
getAsFilein interfaceIResourceBase- Returns:
- the File representation of this resource. May be
nullif this resource cannot be represented as a file.
-
exists
public boolean exists()
- Specified by:
existsin interfaceIResourceBase- Returns:
trueif the resource exists,falseotherwise.
-
getReadableCloneForPath
@Nonnull @UnsupportedOperation public IReadableResource getReadableCloneForPath(@Nonnull String sPath)
Description copied from interface:IReadableResourceGet a new resource of the same implementation type as this object but for a different path.- Specified by:
getReadableCloneForPathin interfaceIReadableResource- Parameters:
sPath- The new path to use. May not benull.- Returns:
- The resource of the same implementation but a different path. May
not be
null.
-
-