public class InputStreamValve extends Object implements Valve<ByteBuffer>
ByteBuffer based Valve that transforms
a possibly blocking InputStream into the Valve.| Modifier and Type | Method and Description |
|---|---|
static Collector<ByteBuffer,ByteArrayOutputStream,ByteBuffer> |
byteBuffer2Collector()
A collector of
ByteBuffer instances into a single ByteBuffer instance. |
static Collector<ByteBuffer,ByteArrayOutputStream,byte[]> |
byteBufferByteArrayCollector()
A collector of
ByteBuffer instances into a single byte array. |
static Collector<ByteBuffer,ByteArrayOutputStream,String> |
byteBufferStringCollector(Charset charset)
A collector of
ByteBuffer instances into a String of the provided
charset. |
protected boolean |
canContinueProcessing()
Implementation of
tryProcess() which initially was accepted by canProcess() should call this method
before every iteration to be sure, that processing can continue (is not paused). |
protected boolean |
canProcess()
Implementation of
tryProcess() method should call this to reserve initial handle processing (if possible). |
protected Runnable |
getOnComplete() |
protected BiConsumer<T,Pausable> |
getOnData() |
protected Consumer<Throwable> |
getOnError() |
void |
handle(BiConsumer<T,Pausable> onData,
Consumer<Throwable> onError,
Runnable onComplete) |
protected void |
handleError(Throwable thr) |
protected ByteBuffer |
moreData() |
void |
pause()
Pause data chunks flow until
Pausable.resume(). |
protected boolean |
paused() |
protected void |
releaseProcessing() |
void |
resume()
Resume data chunks flow after
Pausable.pause(). |
protected void |
tryProcess()
Implements item handling / processing.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected ByteBuffer moreData() throws Throwable
Throwablepublic static Collector<ByteBuffer,ByteArrayOutputStream,String> byteBufferStringCollector(Charset charset)
ByteBuffer instances into a String of the provided
charset.charset - the desired charset of the returned stringpublic static Collector<ByteBuffer,ByteArrayOutputStream,ByteBuffer> byteBuffer2Collector()
ByteBuffer instances into a single ByteBuffer instance.public static Collector<ByteBuffer,ByteArrayOutputStream,byte[]> byteBufferByteArrayCollector()
ByteBuffer instances into a single byte array.protected void tryProcess()
canProcess() and canContinueProcessing()
method to ensure, that processing is done by a single thread at a time.public void pause()
PausablePausable.resume().public void resume()
PausablePausable.pause().public void handle(BiConsumer<T,Pausable> onData, Consumer<Throwable> onError, Runnable onComplete)
protected boolean canProcess()
tryProcess() method should call this to reserve initial handle processing (if possible).
The same method should call canContinueProcessing() before every iteration to be sure, that handle processing
should continue.true only if method can process (handle) itemprotected boolean canContinueProcessing()
tryProcess() which initially was accepted by canProcess() should call this method
before every iteration to be sure, that processing can continue (is not paused).true only if method can continue with handle processingprotected boolean paused()
protected void releaseProcessing()
protected void handleError(Throwable thr)
protected BiConsumer<T,Pausable> getOnData()
protected Runnable getOnComplete()
Copyright © 2018–2019 Oracle Corporation. All rights reserved.