DATA
- The type of the datagram to be operated with.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.OpenedAccessor
, Availability
, ConnectionDatagramsReceiver<DATA,LoopbackDatagramsTransmitter<DATA>>
, DatagramDestination<DATA>
, DatagramReceiver<DATA>
, DatagramsDestination<DATA>
, DatagramsReceiver<DATA>
, Receivable
public class LoopbackDatagramsReceiver<DATA extends Serializable> extends AbstractDatagramsReceiver<DATA> implements ConnectionDatagramsReceiver<DATA,LoopbackDatagramsTransmitter<DATA>>
LoopbackDatagramsReceiver
is a DatagramReceiver
connected
directly within the same JVM with a LoopbackDatagramsTransmitter
; 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 |
---|---|
LoopbackDatagramsReceiver() |
Instantiates a new loopback receiver impl.
|
LoopbackDatagramsReceiver(int aCapacity) |
Instantiates a new loopback receiver impl.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
boolean |
isOpenable(LoopbackDatagramsTransmitter<DATA> aLoopbackSender) |
|
void |
open(LoopbackDatagramsTransmitter<DATA> aLoopbackSender) |
|
void |
pushDatagram(DATA aDatagram) |
Pushes a datagram into the receiver and puts it into the blocking queue
containing the so far received datagrams.
|
void |
pushDatagrams(DATA[] aDatagrams) |
Pushes datagrams into the receiver and puts them into the blocking queue
containing the so far received datagrams.
|
void |
pushDatagrams(DATA[] aDatagrams,
int aOffset,
int aLength) |
Pushes datagrams into the receiver and puts them into the blocking queue
containing the so far received datagrams.
|
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
available, receive, receiveAll
available, hasAvailable
closeIn, closeQuietly, closeUnchecked
getConnectionStatus, isOpened
receive, receive
receive, receiveAll
public LoopbackDatagramsReceiver()
public LoopbackDatagramsReceiver(int aCapacity)
aCapacity
- the capacitypublic boolean isOpenable(LoopbackDatagramsTransmitter<DATA> aLoopbackSender)
isOpenable
in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<DATA extends Serializable>
public void open(LoopbackDatagramsTransmitter<DATA> aLoopbackSender) throws IOException
open
in interface org.refcodes.component.ConnectionOpenable<DATA extends Serializable>
IOException
public void pushDatagram(DATA aDatagram) throws IOException
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 at the end of the blocking
queue; to be retrieved with the AbstractDatagramsReceiver.receive()
method.IOException
- the open exceptionpublic void pushDatagrams(DATA[] aDatagrams) throws IOException
AbstractDatagramsReceiver.receive()
: use AbstractDatagramsReceiver.available()
to test beforehand
whether there is a datagram available.pushDatagrams
in class AbstractDatagramsReceiver<DATA extends Serializable>
aDatagrams
- The datagrams to be pushed at the end of the blocking
queue; to be retrieved with the AbstractDatagramsReceiver.receive()
method.IOException
- the open exceptionpublic void pushDatagrams(DATA[] aDatagrams, int aOffset, int aLength) throws IOException
AbstractDatagramsReceiver.receive()
: use AbstractDatagramsReceiver.available()
to test beforehand
whether there is a datagram available.pushDatagrams
in class AbstractDatagramsReceiver<DATA extends Serializable>
aDatagrams
- The datagrams to be pushed at the end of the blocking
queue; to be retrieved with the AbstractDatagramsReceiver.receive()
method.aOffset
- The offset to start taking data from to be pushed.aLength
- The number of elements to be pushed from the offset
onwards.IOException
- the open exceptionpublic void close() throws IOException
close
in interface org.refcodes.component.Closable
close
in class AbstractDatagramsReceiver<DATA extends Serializable>
IOException
Copyright © 2021. All rights reserved.