@FunctionalInterface
public interface ResourceReader
Resource
,
such as by using the Resource's
InputStream
.ByteBuffer
,
Resource
Modifier and Type | Method and Description |
---|---|
byte[] |
read(org.springframework.core.io.Resource resource)
Reads data from the non-null
Resource into a byte array. |
default java.nio.ByteBuffer |
readIntoByteBuffer(org.springframework.core.io.Resource resource)
Reads data from the non-null
Resource into a ByteBuffer . |
default ResourceReader |
thenReadFrom(ResourceReader reader)
Composes this
ResourceReader with the given ResourceReader
using the Composite Software Design Pattern. |
@NonNull byte[] read(@NonNull org.springframework.core.io.Resource resource)
Resource
into a byte array.
This method should throw an UnhandledResourceException
if the algorithm and strategy used by this reader
is not able to or capable of reading from the Resource
at its location. This allows subsequent readers
in a composition to possibly handle the Resource
. Any other Throwable
thrown by this read
method will break the chain of read calls in the composition.resource
- Resource
to read data from.Resource
.Resource
@NonNull default java.nio.ByteBuffer readIntoByteBuffer(@NonNull org.springframework.core.io.Resource resource)
Resource
into a ByteBuffer
.resource
- Resource
to read data from.ByteBuffer
containing the data from the Resource
.Resource
,
ByteBuffer
,
read(Resource)
@NonNull default ResourceReader thenReadFrom(@Nullable ResourceReader reader)
ResourceReader
with the given ResourceReader
using the Composite Software Design Pattern.reader
- ResourceReader
to compose with this reader.ResourceReader
composed of this ResourceReader
and the given ResourceReader
. If the given ResourceReader
is null,
then this ResourceReader
is returned.ResourceReader