Class ConnectablePayloadWriter<T>
- java.lang.Object
-
- io.servicetalk.concurrent.api.internal.ConnectablePayloadWriter<T>
-
- Type Parameters:
T
- The type of data for thePayloadWriter
.
- All Implemented Interfaces:
PayloadWriter<T>
,java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public final class ConnectablePayloadWriter<T> extends java.lang.Object implements PayloadWriter<T>
APayloadWriter
that can beconnected
to a sink such that any data written on thePayloadWriter
is eventually emitted to the connectedPublisher
PublisherSource.Subscriber
.
-
-
Constructor Summary
Constructors Constructor Description ConnectablePayloadWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Publisher<T>
connect()
Connects thisPayloadWriter
to the returnedPublisher
such that any data written to thisPayloadWriter
is eventually delivered to aPublisherSource.Subscriber
of the returnedPublisher
.void
flush()
void
write(T t)
Write an object of typePayloadWriter
.
-
-
-
Method Detail
-
write
public void write(T t) throws java.io.IOException
Description copied from interface:PayloadWriter
Write an object of typePayloadWriter
.- Specified by:
write
in interfacePayloadWriter<T>
- Parameters:
t
- the object to write.- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if this has been closed.
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
connect
public Publisher<T> connect()
Connects thisPayloadWriter
to the returnedPublisher
such that any data written to thisPayloadWriter
is eventually delivered to aPublisherSource.Subscriber
of the returnedPublisher
.- Returns:
Publisher
that will emit all data written to thisPayloadWriter
to itsPublisherSource.Subscriber
. Only a single activePublisherSource.Subscriber
is allowed for thisPublisher
.
-
-