RecordingPacketConsumer


@ExperimentalApi
public final class RecordingPacketConsumer<T extends Object> implements PacketConsumer


A PacketConsumer implementation that holds a reference to all queued packets, and optionally releases the underlying frames.

Summary

Public constructors

Public methods

final @NonNull Function1<@NonNull T, Unit>
final @NonNull List<@NonNull PacketConsumer.Packet<@NonNull T>>
final @NonNull List<@NonNull T>
void

Queues a Packet for processing, suspending the caller if the consumer is at capacity.

void

Releases all resources.

final void
setOnQueue(@NonNull Function1<@NonNull T, Unit> onQueue)

Public constructors

RecordingPacketConsumer

public <T extends Object> RecordingPacketConsumer()

Public methods

getOnQueue

public final @NonNull Function1<@NonNull T, UnitgetOnQueue()

getQueuedPackets

public final @NonNull List<@NonNull PacketConsumer.Packet<@NonNull T>> getQueuedPackets()

getQueuedPayloads

public final @NonNull List<@NonNull T> getQueuedPayloads()

queuePacket

public void queuePacket(@NonNull PacketConsumer.Packet<@NonNull T> packet)

Queues a Packet for processing, suspending the caller if the consumer is at capacity.

Once this method returns, the ownership of the packet is transferred to this PacketConsumer, and the caller should not modify the packet.

Parameters
@NonNull PacketConsumer.Packet<@NonNull T> packet

The Packet to process.

release

public void release()

Releases all resources.

setOnQueue

public final void setOnQueue(@NonNull Function1<@NonNull T, Unit> onQueue)