Record Class NetworkChannelsPacketSplitter
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.network.chunk.splitter.NetworkChannelsPacketSplitter
- All Implemented Interfaces:
Consumer<eu.cloudnetservice.driver.network.protocol.Packet>
public record NetworkChannelsPacketSplitter(@NonNull Collection<eu.cloudnetservice.driver.network.NetworkChannel> channels)
extends Record
implements Consumer<eu.cloudnetservice.driver.network.protocol.Packet>
A default implementation of a chunked packet splitter, splitting each packet chunk to multiple channels.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull Collection<eu.cloudnetservice.driver.network.NetworkChannel> The field for thechannelsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionNetworkChannelsPacketSplitter(@NonNull Collection<eu.cloudnetservice.driver.network.NetworkChannel> channels) Creates an instance of aNetworkChannelsPacketSplitterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidSends the given packet safely to all listening components of the chunked data transfer.@NonNull Collection<eu.cloudnetservice.driver.network.NetworkChannel> channels()Returns the value of thechannelsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
channels
@NonNull private final @NonNull Collection<eu.cloudnetservice.driver.network.NetworkChannel> channelsThe field for thechannelsrecord component.
-
-
Constructor Details
-
NetworkChannelsPacketSplitter
public NetworkChannelsPacketSplitter(@NonNull @NonNull Collection<eu.cloudnetservice.driver.network.NetworkChannel> channels) Creates an instance of aNetworkChannelsPacketSplitterrecord class.- Parameters:
channels- the value for thechannelsrecord component
-
-
Method Details
-
accept
Sends the given packet safely to all listening components of the chunked data transfer.- Specified by:
acceptin interfaceConsumer<eu.cloudnetservice.driver.network.protocol.Packet>- Parameters:
packet- the packet to send.- Throws:
NullPointerException- if the given packet is null.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
channels
Returns the value of thechannelsrecord component.- Returns:
- the value of the
channelsrecord component
-