public final class FramingMessageSinkConduit extends AbstractSinkConduit<StreamSinkConduit> implements MessageSinkConduit
next
Constructor and Description |
---|
FramingMessageSinkConduit(StreamSinkConduit next,
boolean longLengths,
Pooled<java.nio.ByteBuffer> transmitBuffer)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
flush()
Flush out any unwritten, buffered output.
|
boolean |
send(java.nio.ByteBuffer src)
Send a complete message.
|
boolean |
send(java.nio.ByteBuffer[] srcs,
int offs,
int len)
Send a complete message.
|
boolean |
sendFinal(java.nio.ByteBuffer src)
Send a complete message.
|
boolean |
sendFinal(java.nio.ByteBuffer[] srcs,
int offs,
int len)
Send a complete message.
|
void |
terminateWrites()
Signal that no more write data is forthcoming.
|
void |
truncateWrites()
Terminate writes and discard any outstanding write data.
|
awaitWritable, awaitWritable, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
getWorker
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
awaitWritable, awaitWritable, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
public FramingMessageSinkConduit(StreamSinkConduit next, boolean longLengths, Pooled<java.nio.ByteBuffer> transmitBuffer)
next
- the delegate conduit to setlongLengths
- true
to use 4-byte lengths, false
to use 2-byte lengthstransmitBuffer
- the transmit buffer to usepublic boolean send(java.nio.ByteBuffer src) throws java.io.IOException
MessageSinkConduit
send
in interface MessageSinkConduit
src
- the message to sendtrue
if the message was sent, or false
if it would blockjava.io.IOException
- if an I/O error occurspublic boolean send(java.nio.ByteBuffer[] srcs, int offs, int len) throws java.io.IOException
MessageSinkConduit
send
in interface MessageSinkConduit
srcs
- the buffers holding the message to sendoffs
- the offset into the buffer array of the first bufferlen
- the number of buffers that contain data to sendtrue
if the message was sent, or false
if it would blockjava.io.IOException
- if an I/O error occurspublic boolean sendFinal(java.nio.ByteBuffer src) throws java.io.IOException
MessageSinkConduit
sendFinal
in interface MessageSinkConduit
src
- the message to sendtrue
if the message was sent, or false
if it would blockjava.io.IOException
- if an I/O error occurspublic boolean sendFinal(java.nio.ByteBuffer[] srcs, int offs, int len) throws java.io.IOException
MessageSinkConduit
sendFinal
in interface MessageSinkConduit
srcs
- the buffers holding the message to sendoffs
- the offset into the buffer array of the first bufferlen
- the number of buffers that contain data to sendtrue
if the message was sent, or false
if it would blockjava.io.IOException
- if an I/O error occurspublic boolean flush() throws java.io.IOException
SinkConduit
flush
in interface SinkConduit
flush
in class AbstractSinkConduit<StreamSinkConduit>
true
if everything is flushed, false
otherwisejava.io.IOException
- if flush failspublic void terminateWrites() throws java.io.IOException
SinkConduit
SinkConduit.flush()
ed before it is considered
to be shut down.terminateWrites
in interface SinkConduit
terminateWrites
in class AbstractSinkConduit<StreamSinkConduit>
java.io.IOException
public void truncateWrites() throws java.io.IOException
SinkConduit
truncateWrites
in interface SinkConduit
truncateWrites
in class AbstractSinkConduit<StreamSinkConduit>
java.io.IOException
- if channel termination failed for some reasonCopyright © 2016 JBoss, a division of Red Hat, Inc.