spring-framework / org.springframework.core.io.buffer / DataBufferUtils / write

write

open static fun write(source: Publisher<DataBuffer>, outputStream: OutputStream): Flux<DataBuffer>

Write the given stream of DataBuffers to the given OutputStream. Does not close the output stream when the flux is terminated, and does not release the data buffers in the source. If releasing is required, then subscribe to the returned Flux with a #releaseConsumer().

Note that the writing process does not start until the returned Flux is subscribed to.

Parameters

source - the stream of data buffers to be written

outputStream - the output stream to write to

Return
a flux containing the same buffers as in source, that starts the writing process when subscribed to, and that publishes any writing errors and the completion signal

open static fun write(source: Publisher<DataBuffer>, channel: WritableByteChannel): Flux<DataBuffer>

Write the given stream of DataBuffers to the given WritableByteChannel. Does not close the channel when the flux is terminated, and does not release the data buffers in the source. If releasing is required, then subscribe to the returned Flux with a #releaseConsumer().

Note that the writing process does not start until the returned Flux is subscribed to.

Parameters

source - the stream of data buffers to be written

channel - the channel to write to

Return
a flux containing the same buffers as in source, that starts the writing process when subscribed to, and that publishes any writing errors and the completion signal

open static fun write(source: Publisher<DataBuffer>, channel: AsynchronousFileChannel, position: Long): Flux<DataBuffer>

Write the given stream of DataBuffers to the given AsynchronousFileChannel. Does not close the channel when the flux is terminated, and does not release the data buffers in the source. If releasing is required, then subscribe to the returned Flux with a #releaseConsumer().

Note that the writing process does not start until the returned Flux is subscribed to.

Parameters

source - the stream of data buffers to be written

channel - the channel to write to

Return
a flux containing the same buffers as in source, that starts the writing process when subscribed to, and that publishes any writing errors and the completion signal