T
- The type of data for the PayloadWriter
.public final class ConnectablePayloadWriter<T> extends java.lang.Object implements PayloadWriter<T>
PayloadWriter
that can be connected
to a sink such that any data written on the
PayloadWriter
is eventually emitted to the connected Publisher
PublisherSource.Subscriber
.Constructor and Description |
---|
ConnectablePayloadWriter() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Publisher<T> |
connect()
Connects this
PayloadWriter to the returned Publisher such that any data written to this
PayloadWriter is eventually delivered to a PublisherSource.Subscriber of the returned Publisher . |
void |
flush() |
void |
write(T t)
Write an object of type
T . |
public void write(T t) throws java.io.IOException
PayloadWriter
T
.write
in interface PayloadWriter<T>
t
- the object to write.java.io.IOException
- if an I/O error occurs. In particular, an IOException
may be thrown if this has been
closed.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public Publisher<T> connect()
PayloadWriter
to the returned Publisher
such that any data written to this
PayloadWriter
is eventually delivered to a PublisherSource.Subscriber
of the returned Publisher
.Publisher
that will emit all data written to this PayloadWriter
to its
PublisherSource.Subscriber
. Only a single active PublisherSource.Subscriber
is allowed for this Publisher
.