TransformingResource class abstract
Transforms the bytes of resource on-the-fly.
Warning: The transformation runs on the full content of resource, so it's not appropriate for large resources which can't be held in memory. Also, wrapping a TransformingResource in a CachingResource can be a good idea to cache the result of the transformation in case multiple ranges will be read.
- Inheritance
-
- Object
- Resource
- ProxyResource
- TransformingResource
Constructors
- TransformingResource(Resource resource)
Properties
Methods
-
bytes(
) → Future< ResourceTry< ByteData>> -
cached(
) → Resource -
Creates a cached resource wrapping this resource.
inherited
-
close(
) → Future< void> -
Closes any opened file handles.
inherited
-
length(
) → Future< ResourceTry< int>> -
Returns data length from metadata if available, or calculated from reading the bytes otherwise.
override
-
link(
) → Future< Link> -
Returns the link from which the resource was retrieved.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
{IntRange? range}) → Future< ResourceTry< ByteData>> -
Reads the bytes at the given range.
override
-
readAsJson(
) → Future< ResourceTry< Map< String, dynamic>>> -
Reads the full content as a JSON object.
inherited
-
readAsString(
{String? charset}) → Future< ResourceTry< String>> -
Reads the full content as a String.
inherited
-
readAsXml(
) → Future< ResourceTry< XmlDocument>> -
Reads the full content as an XML document.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform(
ResourceTry< ByteData> data) → Future< ResourceTry< ByteData>> -
use<
R>( Future< R> block(Resource resource)) → Future< R> -
Executes the given block function on this resource and then closes it down correctly whether an exception is thrown or not.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited