DATA
- The type of the datagram to be operated with.public class LoopbackTransceiverImpl<DATA extends Serializable> extends AbstractReceiver<DATA> implements LoopbackConnectionTransceiver<DATA>
org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON>
org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON>
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
org.refcodes.component.Closable.CloseAutomaton
DATAGRAM_QUEUE_SIZE
Constructor and Description |
---|
LoopbackTransceiverImpl() |
LoopbackTransceiverImpl(int aCapacity) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
boolean |
isOpenable(LoopbackConnectionTransceiver<DATA> aLoopbackTransceiver) |
void |
open(LoopbackConnectionTransceiver<DATA> aLoopbackTransceiver) |
void |
pushDatagram(DATA aDatagram)
Pushes a datagram into the receiver and puts it into the blocking queue
containing the so far received datagrams.
|
void |
writeDatagram(DATA aDatagram)
Writes (sends) a datagram to a listening
DatagramReceiver . |
hasDatagram, readDatagram, readDatagrams, releaseAll
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
writeDatagrams, writeDatagrams
readDatagrams
readDatagram
hasDatagram
public LoopbackTransceiverImpl()
public LoopbackTransceiverImpl(int aCapacity)
public boolean isOpenable(LoopbackConnectionTransceiver<DATA> aLoopbackTransceiver)
isOpenable
in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<LoopbackConnectionTransceiver<DATA extends Serializable>>
public void open(LoopbackConnectionTransceiver<DATA> aLoopbackTransceiver) throws org.refcodes.component.OpenException
open
in interface org.refcodes.component.ConnectionOpenable<LoopbackConnectionTransceiver<DATA extends Serializable>>
org.refcodes.component.OpenException
public void writeDatagram(DATA aDatagram) throws org.refcodes.component.OpenException
DatagramSender
DatagramReceiver
.writeDatagram
in interface DatagramSender<DATA extends Serializable>
aDatagram
- The datagram to be pushed to the receiving
DatagramSender
.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void pushDatagram(DATA aDatagram) throws org.refcodes.component.OpenException
AbstractReceiver
AbstractReceiver.readDatagram()
: use AbstractReceiver.hasDatagram()
to test
beforehand whether there is a datagram available.pushDatagram
in interface LoopbackConnectionTransceiver<DATA extends Serializable>
pushDatagram
in class AbstractReceiver<DATA extends Serializable>
aDatagram
- The datagram to be pushed at the end of the blocking
queue; to be retrieved with the AbstractReceiver.readDatagram()
method.org.refcodes.component.OpenException
public void flush() throws org.refcodes.component.OpenException
public void close() throws org.refcodes.component.CloseException
close
in interface org.refcodes.component.Closable
close
in class AbstractReceiver<DATA extends Serializable>
org.refcodes.component.CloseException
Copyright © 2017. All rights reserved.