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

read

open static fun read(inputStream: InputStream, dataBufferFactory: DataBufferFactory, bufferSize: Int): Flux<DataBuffer>

Read the given InputStream into a Flux of DataBuffers. Closes the input stream when the flux is terminated.

Parameters

inputStream - the input stream to read from

dataBufferFactory - the factory to create data buffers with

bufferSize - the maximum size of the data buffers

Return
a flux of data buffers read from the given channel

open static fun read(channel: ReadableByteChannel, dataBufferFactory: DataBufferFactory, bufferSize: Int): Flux<DataBuffer>

Read the given ReadableByteChannel into a Flux of DataBuffers. Closes the channel when the flux is terminated.

Parameters

channel - the channel to read from

dataBufferFactory - the factory to create data buffers with

bufferSize - the maximum size of the data buffers

Return
a flux of data buffers read from the given channel

open static fun read(channel: AsynchronousFileChannel, dataBufferFactory: DataBufferFactory, bufferSize: Int): Flux<DataBuffer>

Read the given AsynchronousFileChannel into a Flux of DataBuffers. Closes the channel when the flux is terminated.

Parameters

channel - the channel to read from

dataBufferFactory - the factory to create data buffers with

bufferSize - the maximum size of the data buffers

Return
a flux of data buffers read from the given channel

open static fun read(channel: AsynchronousFileChannel, position: Long, dataBufferFactory: DataBufferFactory, bufferSize: Int): Flux<DataBuffer>

Read the given AsynchronousFileChannel into a Flux of DataBuffers, starting at the given position. Closes the channel when the flux is terminated.

Parameters

channel - the channel to read from

position - the position to start reading from

dataBufferFactory - the factory to create data buffers with

bufferSize - the maximum size of the data buffers

Return
a flux of data buffers read from the given channel

open static fun read(resource: Resource, dataBufferFactory: DataBufferFactory, bufferSize: Int): Flux<DataBuffer>

Read the given Resource into a Flux of DataBuffers.

If the resource is a file, it is read into an AsynchronousFileChannel and turned to Flux via #read(AsynchronousFileChannel, DataBufferFactory, int) or else fall back on #read(InputStream, DataBufferFactory, int) closes the channel when the flux is terminated.

Parameters

resource - the resource to read from

dataBufferFactory - the factory to create data buffers with

bufferSize - the maximum size of the data buffers

Return
a flux of data buffers read from the given channel

open static fun read(resource: Resource, position: Long, dataBufferFactory: DataBufferFactory, bufferSize: Int): Flux<DataBuffer>

Read the given Resource into a Flux of DataBuffers starting at the given position.

If the resource is a file, it is read into an AsynchronousFileChannel and turned to Flux via #read(AsynchronousFileChannel, DataBufferFactory, int) or else fall back on #read(InputStream, DataBufferFactory, int). Closes the channel when the flux is terminated.

Parameters

resource - the resource to read from

position - the position to start reading from

dataBufferFactory - the factory to create data buffers with

bufferSize - the maximum size of the data buffers

Return
a flux of data buffers read from the given channel