1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.netty.handler.codec.mqtt;
18
19 import io.netty.buffer.ByteBuf;
20 import io.netty.buffer.ByteBufHolder;
21 import io.netty.buffer.ByteBufUtil;
22
23
24
25
26 public class MqttPublishMessage extends MqttMessage implements ByteBufHolder {
27
28 public MqttPublishMessage(
29 MqttFixedHeader mqttFixedHeader,
30 MqttPublishVariableHeader variableHeader,
31 ByteBuf payload) {
32 super(mqttFixedHeader, variableHeader, payload);
33 }
34
35 @Override
36 public MqttPublishVariableHeader variableHeader() {
37 return (MqttPublishVariableHeader) super.variableHeader();
38 }
39
40 @Override
41 public ByteBuf payload() {
42 return content();
43 }
44
45 @Override
46 public ByteBuf content() {
47 return ByteBufUtil.ensureAccessible((ByteBuf) super.payload());
48 }
49
50 @Override
51 public MqttPublishMessage copy() {
52 return replace(content().copy());
53 }
54
55 @Override
56 public MqttPublishMessage duplicate() {
57 return replace(content().duplicate());
58 }
59
60 @Override
61 public MqttPublishMessage retainedDuplicate() {
62 return replace(content().retainedDuplicate());
63 }
64
65 @Override
66 public MqttPublishMessage replace(ByteBuf content) {
67 return new MqttPublishMessage(fixedHeader(), variableHeader(), content);
68 }
69
70 @Override
71 public int refCnt() {
72 return content().refCnt();
73 }
74
75 @Override
76 public MqttPublishMessage retain() {
77 content().retain();
78 return this;
79 }
80
81 @Override
82 public MqttPublishMessage retain(int increment) {
83 content().retain(increment);
84 return this;
85 }
86
87 @Override
88 public MqttPublishMessage touch() {
89 content().touch();
90 return this;
91 }
92
93 @Override
94 public MqttPublishMessage touch(Object hint) {
95 content().touch(hint);
96 return this;
97 }
98
99 @Override
100 public boolean release() {
101 return content().release();
102 }
103
104 @Override
105 public boolean release(int decrement) {
106 return content().release(decrement);
107 }
108
109 }