DATA
- The type of the datagram to be operated with.Flushable
, org.refcodes.component.Closable
, org.refcodes.component.Closable.CloseAutomaton
, org.refcodes.component.ClosedAccessor
, org.refcodes.component.ConnectableComponent
, org.refcodes.component.ConnectableComponent.ConnectableAutomaton
, org.refcodes.component.ConnectionComponent<DATA>
, org.refcodes.component.ConnectionComponent.ConnectionAutomaton<DATA>
, org.refcodes.component.ConnectionOpenable<DATA>
, org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<DATA>
, org.refcodes.component.ConnectionStatusAccessor
, org.refcodes.component.Flushable
, org.refcodes.component.OpenedAccessor
, Availability
, ConnectionDatagramsReceiver<DATA,CON>
, ConnectionDatagramsTransceiver<DATA,LoopbackDatagramsTransceiver<DATA>>
, ConnectionDatagramsTransmitter<DATA,CON>
, DatagramDestination<DATA>
, DatagramReceiver<DATA>
, DatagramsDestination<DATA>
, DatagramSource<DATA>
, DatagramsReceiver<DATA>
, DatagramsSource<DATA>
, DatagramsTransceiver<DATA>
, DatagramsTransmitter<DATA>
, DatagramTransceiver<DATA>
, DatagramTransmitter<DATA>
, Receivable
, Transmittable
public class LoopbackDatagramsTransceiver<DATA extends Serializable> extends AbstractDatagramsReceiver<DATA> implements ConnectionDatagramsTransceiver<DATA,LoopbackDatagramsTransceiver<DATA>>
LoopbackDatagramsTransceiver
is a DatagramTransceiver
connected directly within the same JVM with another
LoopbackDatagramsTransceiver
; a "loopback" connection is used for
establishing the connection which cannot be accessed outside the JVM or the
running machine.org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON extends Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends Object,B extends org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON,B>>
org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON extends Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends Object,B extends org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON,B>>
DATAGRAM_QUEUE_SIZE
Constructor | Description |
---|---|
LoopbackDatagramsTransceiver() |
Instantiates a new loopback transceiver impl.
|
LoopbackDatagramsTransceiver(int aCapacity) |
Instantiates a new loopback transceiver impl.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
void |
flush() |
|
boolean |
isOpenable(LoopbackDatagramsTransceiver<DATA> aLoopbackTransceiver) |
|
void |
open(LoopbackDatagramsTransceiver<DATA> aLoopbackTransceiver) |
|
void |
pushDatagram(DATA aDatagram) |
Pushes a datagram into the
LoopbackDatagramsReceiver . |
void |
transmit(DATA aDatagram) |
Writes (sends) a datagram to a listening
DatagramReceiver . |
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
available, pushDatagrams, pushDatagrams, receive, receiveAll
available, hasAvailable
closeIn, closeQuietly, closeUnchecked
getConnectionStatus, isOpened
receive, receive
receive, receiveAll
transmitAll
transmit
public LoopbackDatagramsTransceiver()
public LoopbackDatagramsTransceiver(int aCapacity)
aCapacity
- the capacitypublic boolean isOpenable(LoopbackDatagramsTransceiver<DATA> aLoopbackTransceiver)
isOpenable
in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<DATA extends Serializable>
public void open(LoopbackDatagramsTransceiver<DATA> aLoopbackTransceiver) throws IOException
open
in interface org.refcodes.component.ConnectionOpenable<DATA extends Serializable>
IOException
public void transmit(DATA aDatagram) throws IOException
DatagramReceiver
.transmit
in interface DatagramSource<DATA extends Serializable>
transmit
in interface DatagramsSource<DATA extends Serializable>
aDatagram
- The datagram to be pushed to the receiving
DatagramSource
.IOException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void pushDatagram(DATA aDatagram) throws IOException
LoopbackDatagramsReceiver
. Them
datagrams can be retrieved via AbstractDatagramsReceiver.receive()
: use
AbstractDatagramsReceiver.available()
to test beforehand whether there is a datagram
available.pushDatagram
in class AbstractDatagramsReceiver<DATA extends Serializable>
aDatagram
- The datagram to be pushed into the
LoopbackDatagramsReceiver
; to be retrieved with the
AbstractDatagramsReceiver.receive()
method.IOException
- the open exceptionpublic void flush() throws IOException
flush
in interface DatagramTransmitter<DATA extends Serializable>
flush
in interface Flushable
flush
in interface org.refcodes.component.Flushable
IOException
public void close() throws IOException
close
in interface org.refcodes.component.Closable
close
in class AbstractDatagramsReceiver<DATA extends Serializable>
IOException
Copyright © 2021. All rights reserved.