1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.channel.unix;
17
18 import io.netty.buffer.ByteBuf;
19 import io.netty.channel.socket.DatagramPacket;
20 import io.netty.util.internal.ObjectUtil;
21
22 import java.net.InetSocketAddress;
23
24
25
26
27
28 public class SegmentedDatagramPacket extends DatagramPacket {
29
30 private final int segmentSize;
31
32
33
34
35
36
37
38
39 public SegmentedDatagramPacket(ByteBuf data, int segmentSize, InetSocketAddress recipient) {
40 super(data, recipient);
41 this.segmentSize = ObjectUtil.checkPositive(segmentSize, "segmentSize");
42 }
43
44
45
46
47
48
49
50
51 public SegmentedDatagramPacket(ByteBuf data, int segmentSize,
52 InetSocketAddress recipient, InetSocketAddress sender) {
53 super(data, recipient, sender);
54 this.segmentSize = ObjectUtil.checkPositive(segmentSize, "segmentSize");
55 }
56
57
58
59
60
61
62 public int segmentSize() {
63 return segmentSize;
64 }
65
66 @Override
67 public SegmentedDatagramPacket copy() {
68 return new SegmentedDatagramPacket(content().copy(), segmentSize, recipient(), sender());
69 }
70
71 @Override
72 public SegmentedDatagramPacket duplicate() {
73 return new SegmentedDatagramPacket(content().duplicate(), segmentSize, recipient(), sender());
74 }
75
76 @Override
77 public SegmentedDatagramPacket retainedDuplicate() {
78 return new SegmentedDatagramPacket(content().retainedDuplicate(), segmentSize, recipient(), sender());
79 }
80
81 @Override
82 public SegmentedDatagramPacket replace(ByteBuf content) {
83 return new SegmentedDatagramPacket(content, segmentSize, recipient(), sender());
84 }
85
86 @Override
87 public SegmentedDatagramPacket retain() {
88 super.retain();
89 return this;
90 }
91
92 @Override
93 public SegmentedDatagramPacket retain(int increment) {
94 super.retain(increment);
95 return this;
96 }
97
98 @Override
99 public SegmentedDatagramPacket touch() {
100 super.touch();
101 return this;
102 }
103
104 @Override
105 public SegmentedDatagramPacket touch(Object hint) {
106 super.touch(hint);
107 return this;
108 }
109 }