1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.http.websocketx;
17
18 import io.netty.buffer.ByteBuf;
19 import io.netty.buffer.Unpooled;
20 import io.netty.util.CharsetUtil;
21
22
23
24
25
26 public class ContinuationWebSocketFrame extends WebSocketFrame {
27
28
29
30
31 public ContinuationWebSocketFrame() {
32 this(Unpooled.buffer(0));
33 }
34
35
36
37
38
39
40
41 public ContinuationWebSocketFrame(ByteBuf binaryData) {
42 super(binaryData);
43 }
44
45
46
47
48
49
50
51
52
53
54
55 public ContinuationWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) {
56 super(finalFragment, rsv, binaryData);
57 }
58
59
60
61
62
63
64
65
66
67
68
69 public ContinuationWebSocketFrame(boolean finalFragment, int rsv, String text) {
70 this(finalFragment, rsv, fromText(text));
71 }
72
73
74
75
76 public String text() {
77 return content().toString(CharsetUtil.UTF_8);
78 }
79
80
81
82
83
84
85
86 private static ByteBuf fromText(String text) {
87 if (text == null || text.isEmpty()) {
88 return Unpooled.EMPTY_BUFFER;
89 } else {
90 return Unpooled.copiedBuffer(text, CharsetUtil.UTF_8);
91 }
92 }
93
94 @Override
95 public ContinuationWebSocketFrame copy() {
96 return (ContinuationWebSocketFrame) super.copy();
97 }
98
99 @Override
100 public ContinuationWebSocketFrame duplicate() {
101 return (ContinuationWebSocketFrame) super.duplicate();
102 }
103
104 @Override
105 public ContinuationWebSocketFrame retainedDuplicate() {
106 return (ContinuationWebSocketFrame) super.retainedDuplicate();
107 }
108
109 @Override
110 public ContinuationWebSocketFrame replace(ByteBuf content) {
111 return new ContinuationWebSocketFrame(isFinalFragment(), rsv(), content);
112 }
113
114 @Override
115 public ContinuationWebSocketFrame retain() {
116 super.retain();
117 return this;
118 }
119
120 @Override
121 public ContinuationWebSocketFrame retain(int increment) {
122 super.retain(increment);
123 return this;
124 }
125
126 @Override
127 public ContinuationWebSocketFrame touch() {
128 super.touch();
129 return this;
130 }
131
132 @Override
133 public ContinuationWebSocketFrame touch(Object hint) {
134 super.touch(hint);
135 return this;
136 }
137 }