public final class BlockingContentWriter extends Object
ContentChannel
. Both write(ByteBuffer)
and close()
methods provide an internal CompletionHandler
to the decorated
ContentChannel
calls, and wait for these to be called before returning. If CompletionHandler.failed(Throwable)
is called, the corresponding Throwable is thrown to the caller.FastContentWriter
Modifier and Type | Field and Description |
---|---|
private ContentChannel |
channel |
Constructor and Description |
---|
BlockingContentWriter(ContentChannel content)
Creates a new BlockingContentWriter that encapsulates a given
ContentChannel . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying
ContentChannel and waits for the operation to complete. |
void |
write(ByteBuffer buf)
Writes to the underlying
ContentChannel and waits for the operation to complete. |
private final ContentChannel channel
public BlockingContentWriter(ContentChannel content)
ContentChannel
.content
- The ContentChannel to encapsulate.NullPointerException
- If the content argument is null.public void write(ByteBuffer buf) throws InterruptedException
ContentChannel
and waits for the operation to complete.buf
- The ByteBuffer to write.InterruptedException
- If the thread was interrupted while waiting.RuntimeException
- If the operation failed to complete, see cause for details.public void close() throws InterruptedException
ContentChannel
and waits for the operation to complete.InterruptedException
- If the thread was interrupted while waiting.RuntimeException
- If the operation failed to complete, see cause for details.Copyright © 2018. All rights reserved.