public class BroadcastTransmitter extends Object
BroadcastReceiver
s.
Note: This class is not threadsafe. Only one transmitter is allowed per broadcast buffer.
Constructor and Description |
---|
BroadcastTransmitter(AtomicBuffer buffer)
Construct a new broadcast transmitter based on an underlying
AtomicBuffer . |
Modifier and Type | Method and Description |
---|---|
int |
capacity()
Get the capacity of the underlying broadcast buffer.
|
int |
maxMsgLength()
Get the maximum message length that can be transmitted for a buffer.
|
void |
transmit(int msgTypeId,
DirectBuffer srcBuffer,
int srcIndex,
int length)
Transmit a message to
BroadcastReceiver s via the broadcast buffer. |
public BroadcastTransmitter(AtomicBuffer buffer)
AtomicBuffer
.
The underlying buffer must a power of 2 in size plus sufficient space
for the BroadcastBufferDescriptor.TRAILER_LENGTH
.buffer
- via which messages will be exchanged.IllegalStateException
- if the buffer capacity is not a power of 2
plus BroadcastBufferDescriptor.TRAILER_LENGTH
in capacity.public int capacity()
public int maxMsgLength()
public void transmit(int msgTypeId, DirectBuffer srcBuffer, int srcIndex, int length)
BroadcastReceiver
s via the broadcast buffer.msgTypeId
- type of the message to be transmitted.srcBuffer
- containing the encoded message to be transmitted.srcIndex
- srcIndex in the source buffer at which the encoded message begins.length
- in bytes of the encoded message.IllegalArgumentException
- of the msgTypeId is not valid,
or if the message length is greater than maxMsgLength()
.Copyright © 2014-2021 Real Logic Limited. All Rights Reserved.