- java.lang.Object
-
- io.netty5.channel.DefaultAddressedEnvelope<Buffer,A>
-
- io.netty5.channel.BufferAddressedEnvelope<SocketAddress,DatagramPacket>
-
- io.netty5.channel.socket.DatagramPacket
-
- io.netty5.channel.unix.SegmentedDatagramPacket
-
- All Implemented Interfaces:
AddressedEnvelope<Buffer,SocketAddress>
,Resource<DatagramPacket>
,AutoCloseable
public class SegmentedDatagramPacket extends DatagramPacket
Allows to use GSO if the underlying OS supports it. Before using this you should ensure your system support it.
-
-
Constructor Summary
Constructors Constructor Description SegmentedDatagramPacket(Buffer message, int segmentSize, InetSocketAddress recipient)
Create a new segmented datagram packet.SegmentedDatagramPacket(Buffer message, int segmentSize, SocketAddress recipient, SocketAddress sender)
Create a new segmented datagram packet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SegmentedDatagramPacket
replace(Buffer content)
Create a new addressed envelope instance, that has the same recipient and sender as this one, but the given content.int
segmentSize()
Return the size of each segment (the last segment can be smaller).SegmentedDatagramPacket
touch(Object hint)
Record the current access location for debugging purposes.-
Methods inherited from class io.netty5.channel.BufferAddressedEnvelope
close, isAccessible, send
-
Methods inherited from class io.netty5.channel.DefaultAddressedEnvelope
content, recipient, sender, toString
-
-
-
-
Constructor Detail
-
SegmentedDatagramPacket
public SegmentedDatagramPacket(Buffer message, int segmentSize, SocketAddress recipient, SocketAddress sender)
Create a new segmented datagram packet. The attached message may be sent in multiple segment-sized network packets.- Parameters:
message
- The data to send.segmentSize
- The (positive) segment size.recipient
- The recipient address.sender
- The sender address.
-
SegmentedDatagramPacket
public SegmentedDatagramPacket(Buffer message, int segmentSize, InetSocketAddress recipient)
Create a new segmented datagram packet. The attached message may be sent in multiple segment-sized network packets.- Parameters:
message
- The data to send.segmentSize
- The (positive) segment size.recipient
- The recipient address.
-
-
Method Detail
-
segmentSize
public int segmentSize()
Return the size of each segment (the last segment can be smaller).- Returns:
- size of segments.
-
replace
public SegmentedDatagramPacket replace(Buffer content)
Description copied from class:BufferAddressedEnvelope
Create a new addressed envelope instance, that has the same recipient and sender as this one, but the given content.- Overrides:
replace
in classDatagramPacket
- Parameters:
content
- The contents of the returned addressed envelope instance.- Returns:
- An addressed envelope instance that has the same recipient and sender as this one, but the given content.
-
touch
public SegmentedDatagramPacket touch(Object hint)
Description copied from interface:Resource
Record the current access location for debugging purposes. This information may be included if the resource throws a life-cycle related exception, or if it leaks. If this resource has already been closed, then this method has no effect.- Specified by:
touch
in interfaceResource<DatagramPacket>
- Overrides:
touch
in classDatagramPacket
- Parameters:
hint
- An optional hint about this access and its context. May benull
.- Returns:
- This resource instance.
-
-