Class ConnectableBufferOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- io.servicetalk.concurrent.api.internal.ConnectableBufferOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public final class ConnectableBufferOutputStream extends java.io.OutputStream
AnOutputStream
that can be connected to a sink such that any data written on theOutputStream
is eventually emitted to the connectedPublisher
PublisherSource.Subscriber
.
-
-
Constructor Summary
Constructors Constructor Description ConnectableBufferOutputStream(BufferAllocator allocator)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Publisher<Buffer>
connect()
Connects thisOutputStream
to the returnedPublisher
such that any data written to thisOutputStream
is eventually delivered to aPublisherSource.Subscriber
of the returnedPublisher
.void
flush()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
-
-
Constructor Detail
-
ConnectableBufferOutputStream
public ConnectableBufferOutputStream(BufferAllocator allocator)
Creates a new instance.- Parameters:
allocator
-BufferAllocator
to convert {code byte[]} toBuffer
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- 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
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
connect
public Publisher<Buffer> connect()
Connects thisOutputStream
to the returnedPublisher
such that any data written to thisOutputStream
is eventually delivered to aPublisherSource.Subscriber
of the returnedPublisher
.- Returns:
Publisher
that will emit all data written to thisOutputStream
to itsPublisherSource.Subscriber
. Only a single activePublisherSource.Subscriber
is allowed for thisPublisher
.
-
-