DATA
- the generic typeFlushable
, 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.ConnectionStatusAccessor
, org.refcodes.component.Flushable
, org.refcodes.component.OpenedAccessor
, DatagramSource<DATA>
, DatagramsSource<DATA>
, DatagramsTransmitter<DATA>
, DatagramTransmitter<DATA>
, Transmittable
public class TransmitterDecorator<DATA extends Serializable> extends AbstractDatagramsTransmitter<DATA> implements DatagramsTransmitter<DATA>
TransmitterDecorator
decorates a DatagramsSource
with the
additional methods of a DatagramsTransmitter
making it easy to use a
DatagramsSource
wherever a DatagramsTransmitter
is expected.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.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
Constructor | Description |
---|---|
TransmitterDecorator(DatagramsSource<DATA> aConsumer) |
Instantiates a new sender decorator.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
void |
flush() |
|
void |
transmit(DATA aDatagram) |
Writes (sends) a datagram to a listening
DatagramReceiver . |
void |
transmit(DATA[] aDatagrams,
int aOffset,
int aLength) |
Write datagrams.
|
void |
transmitAll(DATA[] aDatagrams) |
Writes (sends) a datagram block to a listening
DatagramReceiver
or DatagramsReceiver . |
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
closeIn, closeQuietly, closeUnchecked
public TransmitterDecorator(DatagramsSource<DATA> aConsumer)
aConsumer
- the consumerpublic 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 transmitAll(DATA[] aDatagrams) throws IOException
DatagramReceiver
or DatagramsReceiver
.transmitAll
in interface DatagramsSource<DATA extends Serializable>
aDatagrams
- The datagram to be pushed to the receiving
DatagramReceiver
or DatagramsReceiver
.IOException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void transmit(DATA[] aDatagrams, int aOffset, int aLength) throws IOException
transmit
in interface DatagramsSource<DATA extends Serializable>
transmit
in interface DatagramsTransmitter<DATA extends Serializable>
aDatagrams
- the datagramaOffset
- the offsetaLength
- the lengthIOException
- 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 org.refcodes.component.AbstractConnectableAutomaton
IOException
Copyright © 2021. All rights reserved.