OutputStream and
Flow.Publisher<T> .
Note that this class has a near duplicate in
org..
create(OutputStreamHandler, ByteMapper, Executor)
| Modifier and Type | Class and Description |
|---|---|
| public static interface | OutputStreamPublisher.
the type to map to T>Maps bytes written to in |
| public static interface | OutputStreamPublisher.
Defines the contract for handling the |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final OutputStreamPublisher. | |
| private final int | |
| private static final int | |
| private final Executor | |
| private final OutputStreamPublisher. |
| Access | Constructor and Description |
|---|---|
| private | OutputStreamPublisher(OutputStreamPublisher.
|
| Modifier and Type | Method and Description |
|---|---|
| public static < the publisher type T> Flow. | Returns: aPublisher<T> based on bytes written by
outputStreamHandler mapped by byteMapperinvoked when the first buffer is requested outputStreamHandler,maps written bytes to byteMapper,Tused to invoke the executor)outputStreamHandlerCreates a new |
| public static < the publisher type T> Flow. | Returns: aPublisher<T> based on bytes written by
outputStreamHandler mapped by byteMapperinvoked when the first buffer is requested outputStreamHandler,maps written bytes to byteMapper,Tused to invoke the executor, int chunkSize)outputStreamHandlerCreates a new |
| public void | subscribe(Flow.
the subscriber subscriberImplements java. Adds the given Subscriber if possible. |
| byteMapper | back to summary |
|---|---|
| private final OutputStreamPublisher. | |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| DEFAULT_CHUNK_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_CHUNK_SIZE | |
| executor | back to summary |
|---|---|
| private final Executor executor | |
| outputStreamHandler | back to summary |
|---|---|
| private final OutputStreamPublisher. | |
| OutputStreamPublisher | back to summary |
|---|---|
| private OutputStreamPublisher(OutputStreamPublisher. | |
| create | back to summary |
|---|---|
| public static <T> Flow. Creates a new
| |
| create | back to summary |
|---|---|
| public static <T> Flow. Creates a new
| |
| subscribe | back to summary |
|---|---|
| public void subscribe(Flow. Implements java. Doc from java. Adds the given Subscriber if possible. If already
subscribed, or the attempt to subscribe fails due to policy
violations or errors, the Subscriber's
| |
OutputStreamHandler#handle(OutputStream)
to published items.
| Modifier and Type | Method and Description |
|---|---|
| public T | |
| public T |
| map | back to summary |
|---|---|
| public T map(int b) Maps a single byte to | |
| map | back to summary |
|---|---|
| public T map(byte[] b, int off, int len) Maps a byte array to | |
OutputStream provided by
the OutputStreamPublisher.
| Modifier and Type | Method and Description |
|---|---|
| public void |
| handle | back to summary |
|---|---|
| public void handle(OutputStream outputStream) throws IOException Use the given stream for writing.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Flow. | |
| private final OutputStreamPublisher. | |
| private final int | |
| private volatile Throwable | |
| private final OutputStreamPublisher. | |
| private final AtomicReference | |
| private long | |
| pack-priv static final Object | |
| private final AtomicLong |
| Access | Constructor and Description |
|---|---|
| public | OutputStreamSubscription(Flow.
|
| Modifier and Type | Method and Description |
|---|---|
| private long | |
| private static long | |
| private void | |
| public void | cancel()
Implements java. Causes the Subscriber to (eventually) stop receiving messages. |
| private void | |
| private void | |
| private static boolean | |
| private static boolean | |
| public void | request(long
the increment of demand; a value of n)Long.MAX_VALUE may be considered as effectively unboundedImplements java. Adds the given number |
| private void | |
| private long | |
| private long | |
| private long | |
| public void | write(int
the b)byte.Implements abstract java. Writes the specified byte to this output stream. |
| public void | write(byte[]
the data. b)Overrides java. Writes |
| 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. Writes |
| actual | back to summary |
|---|---|
| private final Flow. | |
| byteMapper | back to summary |
|---|---|
| private final OutputStreamPublisher. | |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| error | back to summary |
|---|---|
| private volatile Throwable error
| |
| outputStreamHandler | back to summary |
|---|---|
| private final OutputStreamPublisher. | |
| parkedThread | back to summary |
|---|---|
| private final AtomicReference<Object> parkedThread | |
| produced | back to summary |
|---|---|
| private long produced | |
| READY | back to summary |
|---|---|
| pack-priv static final Object READY | |
| requested | back to summary |
|---|---|
| private final AtomicLong requested | |
| OutputStreamSubscription | back to summary |
|---|---|
| public OutputStreamSubscription(Flow. | |
| 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 java. Doc from java. Causes the Subscriber to (eventually) stop receiving
messages. Implementation is best-effort -- additional
messages may be received after invoking this method.
A cancelled subscription need not ever receive an
| |
| 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 java. Doc from java. Adds the given number
| |
| 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
| |