Top Description Inners Fields Constructors Methods
reactor.netty

public Class ByteBufFlux

extends FluxOperator<ByteBuf, ByteBuf>
Class Inheritance
Known Direct Subclasses
reactor.netty.ByteBufFlux.ByteBufFluxFuseable
Imports
java.io.IOException, .InputStream, java.nio.ByteBuffer, java.nio.channels.FileChannel, java.nio.charset.Charset, java.nio.file.Path, java.util.Objects, java.util.function.Function, io.netty.buffer.ByteBuf, .ByteBufAllocator, .ByteBufHolder, .CompositeByteBuf, .Unpooled, io.netty.util.IllegalReferenceCountException, org.reactivestreams.Publisher, reactor.core.CoreSubscriber, .Fuseable, reactor.core.publisher.Flux, .FluxOperator, .Mono, reactor.util.Logger, .Loggers

A decorating Flux NettyInbound with various ByteBuf related operations.
Author
Stephane Maldini

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final ByteBufAllocator
pack-priv static final Function<Object, ByteBuf>
bytebufExtractor

A channel object to ByteBuf transformer.

pack-priv static final Logger
pack-priv static final int
Inherited from reactor.core.publisher.FluxOperator:
source

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final ByteBufMono

Returns:

ByteBufMono of aggregated ByteBuf
aggregate
()

Aggregate subsequent byte buffers into a single buffer.

public final Flux<byte[]>

Returns:

a byte[] inbound Flux
asByteArray
()

Convert to a byte[] inbound Flux.

public final Flux<ByteBuffer>

Returns:

a ByteBuffer inbound Flux
asByteBuffer
()

Convert to a ByteBuffer inbound Flux.

public final Flux<InputStream>

Returns:

a InputStream inbound Flux
asInputStream
()

Convert to an InputStream inbound Flux

Note

Auto memory release is disabled.

public final Flux<String>

Returns:

a String inbound Flux
asString
()

Convert to a String inbound Flux using the default Charset.

public final Flux<String>

Returns:

a String inbound Flux
asString
(Charset
the decoding charset
charset
)

Convert to a String inbound Flux using the provided Charset.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromInbound
(Publisher<?>
publisher to decorate
source
)

Decorate as ByteBufFlux.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromInbound
(Publisher<?>
publisher to decorate
source
,
ByteBufAllocator
the channel ByteBufAllocator
allocator
)

Decorate as ByteBufFlux.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromPath
(Path
the path to the resource to stream
path
)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a default maximum size of 500K into the returned ByteBufFlux.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromPath
(Path
the path to the resource to stream
path
,
int
the maximum per-item ByteBuf size
maxChunkSize
)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a given maximum size into the returned ByteBufFlux.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromPath
(Path
the path to the resource to stream
path
,
ByteBufAllocator
the channel ByteBufAllocator
allocator
)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a default maximum size of 500K into the returned ByteBufFlux, using the provided ByteBufAllocator.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromPath
(Path
the path to the resource to stream
path
,
int
the maximum per-item ByteBuf size
maxChunkSize
,
ByteBufAllocator
the channel ByteBufAllocator
allocator
)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a given maximum size into the returned ByteBufFlux, using the provided ByteBufAllocator.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromString
(Publisher<? extends String>
publisher to decorate
source
)

Decorate as ByteBufFlux.

public static ByteBufFlux

Returns:

a ByteBufFlux
fromString
(Publisher<? extends String>
publisher to decorate
source
,
Charset
the encoding charset
charset
,
ByteBufAllocator allocator)

Decorate as ByteBufFlux.

pack-priv static ByteBufFlux
maybeFuse(Flux<ByteBuf> source, ByteBufAllocator allocator)

public final ByteBufMono

Returns:

ByteBufMono of retained ByteBuf
multicast
()

Allow multiple consumers downstream of the flux while also disabling auto memory release on each buffer published (retaining in order to prevent premature recycling).

public final ByteBufFlux

Returns:

ByteBufFlux of retained ByteBuf
retain
()

Disable auto memory release on each buffer published, retaining in order to prevent premature recycling when buffers are accumulated downstream (async).

pack-priv static void
public void
subscribe(CoreSubscriber<? super ByteBuf>
the Subscriber interested into the published sequence
s
)

Implements abstract reactor.core.publisher.Flux.subscribe.

Implements reactor.core.CorePublisher.subscribe.

An internal Publisher#subscribe(Subscriber) that will bypass Hooks#onLastOperator(Function) pointcut.
Inherited from reactor.core.publisher.FluxOperator:
scanUnsafe

Field Detail

allocback to summary
pack-priv final ByteBufAllocator alloc
bytebufExtractorback to summary
pack-priv static final Function<Object, ByteBuf> bytebufExtractor

A channel object to ByteBuf transformer.

logback to summary
pack-priv static final Logger log
MAX_CHUNK_SIZEback to summary
pack-priv static final int MAX_CHUNK_SIZE

Constructor Detail

ByteBufFluxback to summary
pack-priv ByteBufFlux(Flux<ByteBuf> source, ByteBufAllocator allocator)

Method Detail

aggregateback to summary
public final ByteBufMono aggregate()

Aggregate subsequent byte buffers into a single buffer.

Returns:ByteBufMono

ByteBufMono of aggregated ByteBuf

asByteArrayback to summary
public final Flux<byte[]> asByteArray()

Convert to a byte[] inbound Flux.

Returns:Flux<byte[]>

a byte[] inbound Flux

asByteBufferback to summary
public final Flux<ByteBuffer> asByteBuffer()

Convert to a ByteBuffer inbound Flux.

Returns:Flux<ByteBuffer>

a ByteBuffer inbound Flux

asInputStreamback to summary
public final Flux<InputStream> asInputStream()

Convert to an InputStream inbound Flux

Note

Auto memory release is disabled. The underlying ByteBuf will be released only when InputStream#close() is invoked. Ensure InputStream#close() is invoked for any terminal signal: complete | error | cancel

Returns:Flux<InputStream>

a InputStream inbound Flux

asStringback to summary
public final Flux<String> asString()

Convert to a String inbound Flux using the default Charset.

Returns:Flux<String>

a String inbound Flux

asStringback to summary
public final Flux<String> asString(Charset charset)

Convert to a String inbound Flux using the provided Charset.

Parameters
charset:Charset

the decoding charset

Returns:Flux<String>

a String inbound Flux

fromInboundback to summary
public static ByteBufFlux fromInbound(Publisher<?> source)

Decorate as ByteBufFlux.

Parameters
source:Publisher<?>

publisher to decorate

Returns:ByteBufFlux

a ByteBufFlux

fromInboundback to summary
public static ByteBufFlux fromInbound(Publisher<?> source, ByteBufAllocator allocator)

Decorate as ByteBufFlux.

Parameters
source:Publisher<?>

publisher to decorate

allocator:ByteBufAllocator

the channel ByteBufAllocator

Returns:ByteBufFlux

a ByteBufFlux

fromPathback to summary
public static ByteBufFlux fromPath(Path path)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a default maximum size of 500K into the returned ByteBufFlux.

Parameters
path:Path

the path to the resource to stream

Returns:ByteBufFlux

a ByteBufFlux

fromPathback to summary
public static ByteBufFlux fromPath(Path path, int maxChunkSize)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a given maximum size into the returned ByteBufFlux.

Parameters
path:Path

the path to the resource to stream

maxChunkSize:int

the maximum per-item ByteBuf size

Returns:ByteBufFlux

a ByteBufFlux

fromPathback to summary
public static ByteBufFlux fromPath(Path path, ByteBufAllocator allocator)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a default maximum size of 500K into the returned ByteBufFlux, using the provided ByteBufAllocator.

Parameters
path:Path

the path to the resource to stream

allocator:ByteBufAllocator

the channel ByteBufAllocator

Returns:ByteBufFlux

a ByteBufFlux

fromPathback to summary
public static ByteBufFlux fromPath(Path path, int maxChunkSize, ByteBufAllocator allocator)

Open a java.nio.channels.FileChannel from a path and stream ByteBuf chunks with a given maximum size into the returned ByteBufFlux, using the provided ByteBufAllocator.

Parameters
path:Path

the path to the resource to stream

maxChunkSize:int

the maximum per-item ByteBuf size

allocator:ByteBufAllocator

the channel ByteBufAllocator

Returns:ByteBufFlux

a ByteBufFlux

fromStringback to summary
public static ByteBufFlux fromString(Publisher<? extends String> source)

Decorate as ByteBufFlux.

Parameters
source:Publisher<? extends String>

publisher to decorate

Returns:ByteBufFlux

a ByteBufFlux

fromStringback to summary
public static ByteBufFlux fromString(Publisher<? extends String> source, Charset charset, ByteBufAllocator allocator)

Decorate as ByteBufFlux.

Parameters
source:Publisher<? extends String>

publisher to decorate

charset:Charset

the encoding charset

allocator:ByteBufAllocator

the ByteBufAllocator

Returns:ByteBufFlux

a ByteBufFlux

maybeFuseback to summary
pack-priv static ByteBufFlux maybeFuse(Flux<ByteBuf> source, ByteBufAllocator allocator)
multicastback to summary
public final ByteBufMono multicast()

Allow multiple consumers downstream of the flux while also disabling auto memory release on each buffer published (retaining in order to prevent premature recycling).

Returns:ByteBufMono

ByteBufMono of retained ByteBuf

Annotations
@SuppressWarnings:DoNotCallSuggester
retainback to summary
public final ByteBufFlux retain()

Disable auto memory release on each buffer published, retaining in order to prevent premature recycling when buffers are accumulated downstream (async).

Returns:ByteBufFlux

ByteBufFlux of retained ByteBuf

safeReleaseback to summary
pack-priv static void safeRelease(ByteBuf byteBuf)
subscribeback to summary
public void subscribe(CoreSubscriber<? super ByteBuf> s)

Implements abstract reactor.core.publisher.Flux.subscribe.

Implements reactor.core.CorePublisher.subscribe.

Doc from reactor.core.publisher.Flux.subscribe.

An internal Publisher#subscribe(Subscriber) that will bypass Hooks#onLastOperator(Function) pointcut.

In addition to behave as expected by Publisher#subscribe(Subscriber) in a controlled manner, it supports direct subscribe-time Context passing.

Parameters
s:CoreSubscriber<? super ByteBuf>

the Subscriber interested into the published sequence

Annotations
@Override
reactor.netty back to summary

pack-priv final Class ByteBufFlux.ByteBufFluxFuseable

extends ByteBufFlux
implements Fuseable
Class Inheritance
All Implemented Interfaces
reactor.core.Fuseable

Field Summary

Inherited from reactor.netty.ByteBufFlux:
allocbytebufExtractorlogMAX_CHUNK_SIZE

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from reactor.netty.ByteBufFlux:
aggregateasByteArrayasByteBufferasInputStreamasStringasStringfromInboundfromInboundfromPathfromPathfromPathfromPathfromStringfromStringmaybeFusemulticastretainsafeReleasesubscribe

Constructor Detail

ByteBufFluxFuseableback to summary
pack-priv ByteBufFluxFuseable(Flux<ByteBuf> source, ByteBufAllocator allocator)