Package io.helidon.media.common
Class ReadableByteChannelPublisher
- java.lang.Object
-
- io.helidon.media.common.ReadableByteChannelPublisher
-
- All Implemented Interfaces:
Flow.Publisher<DataChunk>
public class ReadableByteChannelPublisher extends Object implements Flow.Publisher<DataChunk>
Publish a channel content to a singlesubscriber
. If channel doesn't offer data, then it is requested again after some period defined be retry schema.Only first subscriber is accepted.
-
-
Constructor Summary
Constructors Constructor Description ReadableByteChannelPublisher(ReadableByteChannel channel, RetrySchema retrySchema)
Creates new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
subscribe(Flow.Subscriber<? super DataChunk> subscriberParam)
Adds the given Subscriber if possible.
-
-
-
Constructor Detail
-
ReadableByteChannelPublisher
public ReadableByteChannelPublisher(ReadableByteChannel channel, RetrySchema retrySchema)
Creates new instance.- Parameters:
channel
- a channel to read and publishretrySchema
- a retry schema functional interface used in case, that channel read retrieved zero bytes.
-
-
Method Detail
-
subscribe
public void subscribe(Flow.Subscriber<? super DataChunk> subscriberParam)
Description copied from interface:Flow.Publisher
Adds the given Subscriber if possible. If already subscribed, or the attempt to subscribe fails due to policy violations or errors, the Subscriber'sonError
method is invoked with anIllegalStateException
. Otherwise, the Subscriber'sonSubscribe
method is invoked with a newFlow.Subscription
. Subscribers may enable receiving items by invoking therequest
method of this Subscription, and may unsubscribe by invoking itscancel
method.- Specified by:
subscribe
in interfaceFlow.Publisher<DataChunk>
- Parameters:
subscriberParam
- the subscriber
-
-