T - the type of the stream elementpublic interface StreamWriter<T>
StreamMessage.
When the following methods are given with a ReferenceCounted object, such as ByteBuf and
ByteBufHttpData, or the Supplier that provides such an object:
false or raises an exception.Subscriber of the stream consumes it.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the
StreamMessage successfully. |
default void |
close(T obj)
Writes the given object and closes the stream successfully.
|
void |
close(Throwable cause)
Closes the
StreamMessage exceptionally. |
boolean |
isOpen()
Returns
true if the StreamMessage is open. |
CompletableFuture<Void> |
onDemand(Runnable task)
Performs the specified
task when there are enough demands from the Subscriber. |
default boolean |
tryWrite(Supplier<? extends T> o)
Writes the specified object
Supplier to the StreamMessage. |
boolean |
tryWrite(T o)
Writes the specified object to the
StreamMessage. |
default void |
write(Supplier<? extends T> o)
Writes the specified object
Supplier to the StreamMessage. |
default void |
write(T o)
Writes the specified object to the
StreamMessage. |
boolean isOpen()
true if the StreamMessage is open.default void write(T o)
StreamMessage. The written object will be transferred to the
Subscriber.ClosedPublisherException - if the stream was already closedIllegalArgumentException - if the publication of the specified object has been rejecteddefault void write(Supplier<? extends T> o)
Supplier to the StreamMessage. The object provided by the
Supplier will be transferred to the Subscriber.ClosedPublisherException - if the stream was already closed.@CheckReturnValue boolean tryWrite(T o)
StreamMessage. The written object will be transferred to the
Subscriber.true if the specified object has been scheduled for publication. false if the
stream has been closed already.IllegalArgumentException - if the publication of the specified object has been rejected@CheckReturnValue default boolean tryWrite(Supplier<? extends T> o)
Supplier to the StreamMessage. The object provided by the
Supplier will be transferred to the Subscriber.true if the specified object has been scheduled for publication. false if the
stream has been closed already.CompletableFuture<Void> onDemand(Runnable task)
task when there are enough demands from the Subscriber.task finishes or
exceptionally when the StreamMessage is closed unexpectedly.void close()
StreamMessage successfully. Subscriber.onComplete() will be invoked to
signal that the Subscriber has consumed the stream completely.void close(Throwable cause)
StreamMessage exceptionally. Subscriber.onError(Throwable) will be invoked to
signal that the Subscriber did not consume the stream completely.default void close(T obj)
Copyright © 2020 LeanCloud. All rights reserved.