public abstract class DataBufferUtils extends Object
DataBuffer
s.Constructor and Description |
---|
DataBufferUtils() |
Modifier and Type | Method and Description |
---|---|
static reactor.core.publisher.Flux<DataBuffer> |
read(InputStream inputStream,
DataBufferFactory dataBufferFactory,
int bufferSize)
Read the given
InputStream into a Flux of
DataBuffer s. |
static reactor.core.publisher.Flux<DataBuffer> |
read(ReadableByteChannel channel,
DataBufferFactory dataBufferFactory,
int bufferSize)
Read the given
ReadableByteChannel into a Flux of
DataBuffer s. |
static boolean |
release(DataBuffer dataBuffer)
Release the given data buffer, if it is a
PooledDataBuffer . |
static <T extends DataBuffer> |
retain(T dataBuffer)
Retain the given data buffer, it it is a
PooledDataBuffer . |
static reactor.core.publisher.Flux<DataBuffer> |
skipUntilByteCount(org.reactivestreams.Publisher<DataBuffer> publisher,
long maxByteCount)
Skip buffers from the given
Publisher until the total
byte count reaches
the given maximum byte count, or until the publisher is complete. |
static reactor.core.publisher.Flux<DataBuffer> |
takeUntilByteCount(org.reactivestreams.Publisher<DataBuffer> publisher,
long maxByteCount)
Relay buffers from the given
Publisher until the total
byte count reaches
the given maximum byte count, or until the publisher is complete. |
public static reactor.core.publisher.Flux<DataBuffer> read(InputStream inputStream, DataBufferFactory dataBufferFactory, int bufferSize)
InputStream
into a Flux
of
DataBuffer
s. Closes the input stream when the flux is terminated.inputStream
- the input stream to read fromdataBufferFactory
- the factory to create data buffers withbufferSize
- the maximum size of the data bufferspublic static reactor.core.publisher.Flux<DataBuffer> read(ReadableByteChannel channel, DataBufferFactory dataBufferFactory, int bufferSize)
ReadableByteChannel
into a Flux
of
DataBuffer
s. Closes the channel when the flux is terminated.channel
- the channel to read fromdataBufferFactory
- the factory to create data buffers withbufferSize
- the maximum size of the data bufferspublic static reactor.core.publisher.Flux<DataBuffer> takeUntilByteCount(org.reactivestreams.Publisher<DataBuffer> publisher, long maxByteCount)
Publisher
until the total
byte count reaches
the given maximum byte count, or until the publisher is complete.publisher
- the publisher to filtermaxByteCount
- the maximum byte countmaxByteCount
public static reactor.core.publisher.Flux<DataBuffer> skipUntilByteCount(org.reactivestreams.Publisher<DataBuffer> publisher, long maxByteCount)
Publisher
until the total
byte count reaches
the given maximum byte count, or until the publisher is complete.publisher
- the publisher to filtermaxByteCount
- the maximum byte countpublic static <T extends DataBuffer> T retain(T dataBuffer)
PooledDataBuffer
.dataBuffer
- the data buffer to retainpublic static boolean release(DataBuffer dataBuffer)
PooledDataBuffer
.dataBuffer
- the data buffer to releasetrue
if the buffer was released; false
otherwise.