OutputStream and
Publisher<DataBuffer>.
Note that this class has a near duplicate in
org..
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final DataBufferFactory | |
| private final int | |
| private final Executor | |
| private final Consumer |
| Access | Constructor and Description |
|---|---|
| pack-priv | OutputStreamPublisher(Consumer<OutputStream> outputStreamConsumer, DataBufferFactory bufferFactory, Executor executor, int chunkSize)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | subscribe(Subscriber<? super DataBuffer>
the subscriber)Subscriber that will consume signals from this PublisherImplements org. Publisher to start streaming data.
|
| bufferFactory | back to summary |
|---|---|
| private final DataBufferFactory bufferFactory | |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| executor | back to summary |
|---|---|
| private final Executor executor | |
| outputStreamConsumer | back to summary |
|---|---|
| private final Consumer<OutputStream> outputStreamConsumer | |
| OutputStreamPublisher | back to summary |
|---|---|
| pack-priv OutputStreamPublisher(Consumer<OutputStream> outputStreamConsumer, DataBufferFactory bufferFactory, Executor executor, int chunkSize) | |
| subscribe | back to summary |
|---|---|
| public void subscribe(Subscriber<? super DataBuffer> subscriber) Implements org. Doc from org. Request
This is a "factory method" and can be called multiple times, each time starting a new
Each
A
If the
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Subscriber | |
| private final DataBufferFactory | |
| private final int | |
| private volatile Throwable | |
| private final Consumer | |
| private final AtomicReference | |
| private long | |
| private static final Object | |
| private final AtomicLong |
| Access | Constructor and Description |
|---|---|
| pack-priv | OutputStreamSubscription(Subscriber<? super DataBuffer> actual, Consumer<OutputStream> outputStreamConsumer, DataBufferFactory bufferFactory, int chunkSize)
|
| Modifier and Type | Method and Description |
|---|---|
| private long | |
| private static long | |
| private void | |
| public void | cancel()
Implements org. Publisher to stop sending data and clean up resources.
|
| private void | |
| private void | |
| private static boolean | |
| private static boolean | |
| public void | request(long
the strictly positive number of elements to requests to the upstream n)PublisherImplements org. Publisher until demand is signaled via this method.
|
| private void | |
| private long | |
| private long | |
| private long | |
| public void | write(int
the b)byte.Implements abstract java. |
| public void | write(byte[]
the data. b)Overrides java. b.length bytes from the specified byte array
to this output stream.
|
| public void | write(byte[]
the data. b, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. len bytes from the specified byte array
starting at offset off to this output stream.
|
| actual | back to summary |
|---|---|
| private final Subscriber<? super DataBuffer> actual | |
| bufferFactory | back to summary |
|---|---|
| private final DataBufferFactory bufferFactory | |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| error | back to summary |
|---|---|
| private volatile Throwable error
| |
| outputStreamHandler | back to summary |
|---|---|
| private final Consumer<OutputStream> outputStreamHandler | |
| parkedThread | back to summary |
|---|---|
| private final AtomicReference<Object> parkedThread | |
| produced | back to summary |
|---|---|
| private long produced | |
| READY | back to summary |
|---|---|
| private static final Object READY | |
| requested | back to summary |
|---|---|
| private final AtomicLong requested | |
| OutputStreamSubscription | back to summary |
|---|---|
| pack-priv OutputStreamSubscription(Subscriber<? super DataBuffer> actual, Consumer<OutputStream> outputStreamConsumer, DataBufferFactory bufferFactory, int chunkSize) | |
| addCap | back to summary |
|---|---|
| private long addCap(long n) | |
| addCap | back to summary |
|---|---|
| private static long addCap(long a, long b) | |
| await | back to summary |
|---|---|
| private void await() | |
| cancel | back to summary |
|---|---|
| public void cancel() Implements org. Doc from org. Request the Data may still be sent to meet previously signalled demand after calling cancel.
| |
| checkDemandAndAwaitIfNeeded | back to summary |
|---|---|
| private void checkDemandAndAwaitIfNeeded() throws IOException | |
| invokeHandler | back to summary |
|---|---|
| private void invokeHandler() | |
| isCancelled | back to summary |
|---|---|
| private static boolean isCancelled(long state) | |
| isTerminated | back to summary |
|---|---|
| private static boolean isTerminated(long state) | |
| request | back to summary |
|---|---|
| public void request(long n) Implements org. Doc from org. No events will be sent by a
It can be called however often and whenever needed—but if the outstanding cumulative demand ever becomes Long.MAX_VALUE or more,
it may be treated by the
Whatever has been requested can be sent by the
A | |
| resume | back to summary |
|---|---|
| private void resume() | |
| tryCancel | back to summary |
|---|---|
| private long tryCancel() | |
| tryProduce | back to summary |
|---|---|
| private long tryProduce(long n) | |
| tryTerminate | back to summary |
|---|---|
| private long tryTerminate() | |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| public void write(byte[] b) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(byte[] b, int off, int len) throws IOException Overrides java. Doc from java. Writes
If
If
| |