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 an
IReadableResource that 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
ConstructorsModifierConstructorDescriptionprotectedAbstractMemoryReadableResource(String sResourceID) Constructor. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.io.IHasInputStream
getBufferedInputStream, getInputStream, isReadMultipleMethods inherited from interface com.helger.commons.io.IHasInputStreamAndReader
getBufferedReader, getReader
-
Constructor Details
-
AbstractMemoryReadableResource
Constructor.- Parameters:
sResourceID- The mandatory resource ID, used as the cache key. May neither benullnor empty.
-
-
Method Details
-
getResourceID
- Specified by:
getResourceIDin interfaceIResourceBase- Returns:
- The resource ID as provided in the constructor. Neither
nullnor empty.
-
getPath
- Specified by:
getPathin interfaceIResourceBase- Returns:
- The requested path. Never
null
-
getAsURL
- Specified by:
getAsURLin interfaceIResourceBase- Returns:
- the URL representation of this resource. May be
nullif this resource cannot be represented as an URL.
-
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.
-
toString
-