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.DefaultByteBufHolder;
20 import io.netty.util.internal.StringUtil;
21
22
23
24
25 public abstract class WebSocketFrame extends DefaultByteBufHolder {
26
27
28
29
30
31 private final boolean finalFragment;
32
33
34
35
36 private final int rsv;
37
38 protected WebSocketFrame(ByteBuf binaryData) {
39 this(true, 0, binaryData);
40 }
41
42 protected WebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) {
43 super(binaryData);
44 this.finalFragment = finalFragment;
45 this.rsv = rsv;
46 }
47
48
49
50
51
52 public boolean isFinalFragment() {
53 return finalFragment;
54 }
55
56
57
58
59 public int rsv() {
60 return rsv;
61 }
62
63 @Override
64 public WebSocketFrame copy() {
65 return (WebSocketFrame) super.copy();
66 }
67
68 @Override
69 public WebSocketFrame duplicate() {
70 return (WebSocketFrame) super.duplicate();
71 }
72
73 @Override
74 public WebSocketFrame retainedDuplicate() {
75 return (WebSocketFrame) super.retainedDuplicate();
76 }
77
78 @Override
79 public abstract WebSocketFrame replace(ByteBuf content);
80
81 @Override
82 public String toString() {
83 return StringUtil.simpleClassName(this) + "(data: " + contentToString() + ')';
84 }
85
86 @Override
87 public WebSocketFrame retain() {
88 super.retain();
89 return this;
90 }
91
92 @Override
93 public WebSocketFrame retain(int increment) {
94 super.retain(increment);
95 return this;
96 }
97
98 @Override
99 public WebSocketFrame touch() {
100 super.touch();
101 return this;
102 }
103
104 @Override
105 public WebSocketFrame touch(Object hint) {
106 super.touch(hint);
107 return this;
108 }
109 }