public class AckFilterLayer extends FilterLayer
FilterLayer that ensures both sides will not proceed unless the acknowledgement has been sent and
received by both sides.ProtocolLayer.Recv, ProtocolLayer.SendEMPTY_BUFFER, UTF_8| Constructor and Description |
|---|
AckFilterLayer()
Default constructor.
|
AckFilterLayer(String ack)
Constructor using a custom acknowledgement string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
doSend(ByteBuffer data)
SPI: Sends data to the lower layer.
|
boolean |
isRecvOpen()
Tracks if this layer is accepting received data via
ProtocolLayer.Recv.onRecv(ByteBuffer). |
void |
onRecv(ByteBuffer data)
SPI: Callback on data being received from the lower layer.
|
void |
onRecvClosed(IOException cause)
Callback on the lower layer's source of data being closed.
|
void |
start()
Starts this layer.
|
abort, completed, doCloseSend, flushRecv, flushSend, init, isSendOpen, next, stackpublic AckFilterLayer()
public AckFilterLayer(String ack)
ack - the acknowledgement string.public void start()
throws IOException
start in interface ProtocolLayerstart in class FilterLayerIOException - if something goes wrong.public void onRecv(@Nonnull ByteBuffer data) throws IOException
onRecv in interface ProtocolLayer.RecvonRecv in class FilterLayerdata - the data received. Any data consumed from the ByteBuffer can be assumed as processed.
Any data not consumed from the ByteBuffer will be the responsibility of the caller
to resubmit in subsequent calls.IOException - if there was an error during processing of the received data.public void onRecvClosed(IOException cause) throws IOException
onRecvClosed in interface ProtocolLayer.RecvonRecvClosed in class FilterLayercause - the cause of the lower layer being closed or null.IOException - if there was an error during the processing of the close notification.public boolean isRecvOpen()
ProtocolLayer.Recv.onRecv(ByteBuffer).
Once this method returns false it must always return false and can be assumed to behave in
this way.isRecvOpen in interface ProtocolLayer.RecvisRecvOpen in class FilterLayertrue if accepting received data via ProtocolLayer.Recv.onRecv(ByteBuffer).public void doSend(@Nonnull ByteBuffer data) throws IOException
doSend in interface ProtocolLayer.SenddoSend in class FilterLayerdata - the data to send. Any data consumed from the ByteBuffer can be assumed as processed.
Any data not consumed from the ByteBuffer will be the responsibility of the caller
to resubmit in subsequent calls.IOException - if there was an error during processing of the data.Copyright © 2004–2020. All rights reserved.