@FunctionalInterface
public interface ResourceWriter
Resource
,
such as by using the WritableResource's
WritableResource.getOutputStream()
OutputStream}.Resource
,
WritableResource
Modifier and Type | Method and Description |
---|---|
default ResourceWriter |
thenWriteTo(ResourceWriter writer)
Composes this
ResourceWriter with the given ResourceWriter
using the Composite Software Design Pattern. |
void |
write(org.springframework.core.io.Resource resource,
byte[] data)
Writes data to the target
Resource as defined by the algorithm/strategy of this writer. |
default void |
write(org.springframework.core.io.Resource resource,
java.nio.ByteBuffer data)
Writes data contained in the
ByteBuffer to the target Resource as defined by
the algorithm/strategy of this writer. |
void write(@NonNull org.springframework.core.io.Resource resource, byte[] data)
Resource
as defined by the algorithm/strategy of this writer.
This method should throw an UnhandledResourceException
if the algorithm or strategy used by this writer
is not able to or capable of writing to the Resource
at its location. This allows subsequent writers
in a composition to possibly handle the Resource
. Any other Exception
thrown by this
write
method will break the chain of write calls in the composition.resource
- Resource
to write data to.data
- array of bytes containing the data to write to the target Resource
.Resource
default void write(@NonNull org.springframework.core.io.Resource resource, java.nio.ByteBuffer data)
ByteBuffer
to the target Resource
as defined by
the algorithm/strategy of this writer.
This method should throw an UnhandledResourceException
if the algorithm or strategy used by this writer
is not able to or capable of writing to the Resource
at its location. This allows subsequent writers
in a composition to possibly handle the Resource
. Any other Exception
thrown by this
write
method will break the chain of write calls in the composition.resource
- Resource
to write data to.data
- ByteBuffer
containing the data to write to the target Resource
.Resource
,
ByteBuffer
,
write(Resource, byte[])
default ResourceWriter thenWriteTo(ResourceWriter writer)
ResourceWriter
with the given ResourceWriter
using the Composite Software Design Pattern.writer
- ResourceWriter
to compose with this writer.ResourceWriter
composed of this ResourceWriter
and the given ResourceWriter
. If the given ResourceWriter
is null,
then this ResourceWriter
is returned.ResourceWriter