Package org.refcodes.io
Class LoopbackByteTransceiverImpl
- java.lang.Object
-
- org.refcodes.io.AbstractByteProvider
-
- org.refcodes.io.AbstractByteReceiver
-
- org.refcodes.io.LoopbackByteTransceiverImpl
-
- All Implemented Interfaces:
java.io.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<LoopbackByteTransceiver>
,org.refcodes.component.ConnectionComponent.ConnectionAutomaton<LoopbackByteTransceiver>
,org.refcodes.component.ConnectionOpenable<LoopbackByteTransceiver>
,org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<LoopbackByteTransceiver>
,org.refcodes.component.ConnectionStatusAccessor
,org.refcodes.component.Flushable
,org.refcodes.component.OpenedAccessor
,ByteBlockConsumer
,ByteBlockProvider
,ByteBlockReceiver
,ByteBlockSender
,ByteConsumer
,ByteDatagramConsumer
,ByteDatagramProvider
,ByteDatagramReceiver
,ByteDatagramSender
,ByteProvider
,ByteReceiver
,ByteSender
,ByteTransceiver
,ConnectionByteReceiver<LoopbackByteTransceiver>
,ConnectionByteSender<LoopbackByteTransceiver>
,ConnectionByteTransceiver<LoopbackByteTransceiver>
,LoopbackByteTransceiver
,Receivable
,Sendable
,org.refcodes.mixin.Releaseable
public class LoopbackByteTransceiverImpl extends AbstractByteReceiver implements LoopbackByteTransceiver
Implementation of theLoopbackByteTransceiver
interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.refcodes.io.AbstractByteReceiver
AbstractByteReceiver.ConnectableAutomaton
-
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionComponent
org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON extends java.lang.Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends java.lang.Object,B extends org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON,B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionOpenable
org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON extends java.lang.Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends java.lang.Object,B extends org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON,B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
-
-
Field Summary
-
Fields inherited from class org.refcodes.io.AbstractByteProvider
_datagramQueue, DATAGRAM_QUEUE_SIZE
-
Fields inherited from class org.refcodes.io.AbstractByteReceiver
_automaton
-
-
Constructor Summary
Constructors Constructor Description LoopbackByteTransceiverImpl()
Instantiates a new loopback byte transceiver impl.LoopbackByteTransceiverImpl(int aCapacity)
Instantiates a new loopback byte transceiver impl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
boolean
isOpenable(LoopbackByteTransceiver aLoopbackTransceiver)
void
open(LoopbackByteTransceiver aLoopbackTransceiver)
void
pushDatagram(byte aDatagram)
Pushes a datagram into the receiver and puts it into the blocking queue containing the so far received datagrams.void
writeDatagram(byte aDatagram)
Writes (sends) a byte.-
Methods inherited from class org.refcodes.io.AbstractByteProvider
pushDatagrams, pushDatagrams
-
Methods inherited from class org.refcodes.io.AbstractByteReceiver
getConnectionStatus, hasDatagram, isClosable, isClosed, isOpenable, isOpened, open, readDatagram, readDatagrams, readDatagrams, releaseAll, setConnectionStatus
-
Methods inherited from interface org.refcodes.io.ByteConsumer
writeDatagrams
-
Methods inherited from interface org.refcodes.io.ByteDatagramProvider
readDatagram
-
Methods inherited from interface org.refcodes.io.ByteReceiver
readDatagrams, readDatagrams
-
Methods inherited from interface org.refcodes.io.ByteSender
writeDatagrams
-
Methods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isConnectionOpened
-
Methods inherited from interface org.refcodes.mixin.Loggable
alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.io.Receivable
hasDatagram
-
-
-
-
Constructor Detail
-
LoopbackByteTransceiverImpl
public LoopbackByteTransceiverImpl()
Instantiates a new loopback byte transceiver impl.
-
LoopbackByteTransceiverImpl
public LoopbackByteTransceiverImpl(int aCapacity)
Instantiates a new loopback byte transceiver impl.- Parameters:
aCapacity
- the capacity
-
-
Method Detail
-
isOpenable
public boolean isOpenable(LoopbackByteTransceiver aLoopbackTransceiver)
- Specified by:
isOpenable
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<LoopbackByteTransceiver>
-
open
public void open(LoopbackByteTransceiver aLoopbackTransceiver) throws org.refcodes.component.OpenException
- Specified by:
open
in interfaceorg.refcodes.component.ConnectionOpenable<LoopbackByteTransceiver>
- Throws:
org.refcodes.component.OpenException
-
writeDatagram
public void writeDatagram(byte aDatagram) throws org.refcodes.component.OpenException
Writes (sends) a byte.- Specified by:
writeDatagram
in interfaceByteConsumer
- Specified by:
writeDatagram
in interfaceByteDatagramConsumer
- Parameters:
aDatagram
- The byte to be pushed.- Throws:
org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
-
pushDatagram
public void pushDatagram(byte aDatagram) throws org.refcodes.component.OpenException
Pushes a datagram into the receiver and puts it into the blocking queue containing the so far received datagrams. Them datagrams can be retrieved viaAbstractByteProvider.readDatagram()
: UseAbstractByteReceiver
extension'sAbstractByteReceiver.hasDatagram()
to test beforehand whether there is a datagram available.- Specified by:
pushDatagram
in interfaceLoopbackByteTransceiver
- Overrides:
pushDatagram
in classAbstractByteProvider
- Parameters:
aDatagram
- The datagram to be pushed at the end of the blocking queue; to be retrieved with theAbstractByteProvider.readDatagram()
method.- Throws:
org.refcodes.component.OpenException
- the open exception
-
flush
public void flush() throws org.refcodes.component.OpenException
- Specified by:
flush
in interfaceByteSender
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in interfaceorg.refcodes.component.Flushable
- Throws:
org.refcodes.component.OpenException
-
close
public void close() throws org.refcodes.component.CloseException
- Specified by:
close
in interfaceorg.refcodes.component.Closable
- Overrides:
close
in classAbstractByteReceiver
- Throws:
org.refcodes.component.CloseException
-
-