@@ -105,7 +105,7 @@ static class FrameFactory
105
105
106
106
static final WebSocketFrameFactory INSTANCE = new FrameFactory ();
107
107
108
- ByteBuf createDataFrame (
108
+ final ByteBuf createDataFrame (
109
109
ByteBufAllocator allocator , int payloadSize , int prefixSmall , int prefixMedium ) {
110
110
int mask = mask ();
111
111
if (payloadSize <= 125 ) {
@@ -125,35 +125,35 @@ ByteBuf createDataFrame(
125
125
}
126
126
127
127
@ Override
128
- public ByteBuf createBinaryFrame (ByteBufAllocator allocator , int payloadSize ) {
128
+ public final ByteBuf createBinaryFrame (ByteBufAllocator allocator , int payloadSize ) {
129
129
return createDataFrame (allocator , payloadSize , BINARY_FRAME_SMALL , BINARY_FRAME_MEDIUM );
130
130
}
131
131
132
132
@ Override
133
- public ByteBuf createTextFrame (ByteBufAllocator allocator , int payloadSize ) {
133
+ public final ByteBuf createTextFrame (ByteBufAllocator allocator , int payloadSize ) {
134
134
return createDataFrame (allocator , payloadSize , TEXT_FRAME_SMALL , TEXT_FRAME_MEDIUM );
135
135
}
136
136
137
137
@ Override
138
- public ByteBuf createBinaryFragmentStart (ByteBufAllocator allocator , int binaryDataSize ) {
138
+ public final ByteBuf createBinaryFragmentStart (ByteBufAllocator allocator , int binaryDataSize ) {
139
139
return createDataFrame (
140
140
allocator , binaryDataSize , BINARY_FRAGMENT_START_SMALL , BINARY_FRAGMENT_START_MEDIUM );
141
141
}
142
142
143
143
@ Override
144
- public ByteBuf createTextFragmentStart (ByteBufAllocator allocator , int textDataSize ) {
144
+ public final ByteBuf createTextFragmentStart (ByteBufAllocator allocator , int textDataSize ) {
145
145
return createDataFrame (
146
146
allocator , textDataSize , TEXT_FRAGMENT_START_SMALL , TEXT_FRAGMENT_START_MEDIUM );
147
147
}
148
148
149
149
@ Override
150
- public ByteBuf createContinuationFragment (ByteBufAllocator allocator , int dataSize ) {
150
+ public final ByteBuf createContinuationFragment (ByteBufAllocator allocator , int dataSize ) {
151
151
return createDataFrame (
152
152
allocator , dataSize , DATA_FRAGMENT_CONTINUATION_SMALL , DATA_FRAGMENT_CONTINUATION_MEDIUM );
153
153
}
154
154
155
155
@ Override
156
- public ByteBuf createContinuationFragmentEnd (ByteBufAllocator allocator , int dataSize ) {
156
+ public final ByteBuf createContinuationFragmentEnd (ByteBufAllocator allocator , int dataSize ) {
157
157
return createDataFrame (
158
158
allocator ,
159
159
dataSize ,
@@ -162,7 +162,8 @@ public ByteBuf createContinuationFragmentEnd(ByteBufAllocator allocator, int dat
162
162
}
163
163
164
164
@ Override
165
- public ByteBuf createCloseFrame (ByteBufAllocator allocator , int statusCode , String reason ) {
165
+ public final ByteBuf createCloseFrame (
166
+ ByteBufAllocator allocator , int statusCode , String reason ) {
166
167
if (!WebSocketCloseStatus .isValidStatusCode (statusCode )) {
167
168
throw new IllegalArgumentException ("incorrect close status code: " + statusCode );
168
169
}
@@ -188,7 +189,7 @@ public ByteBuf createCloseFrame(ByteBufAllocator allocator, int statusCode, Stri
188
189
}
189
190
190
191
@ Override
191
- public ByteBuf createPingFrame (ByteBufAllocator allocator , int payloadSize ) {
192
+ public final ByteBuf createPingFrame (ByteBufAllocator allocator , int payloadSize ) {
192
193
if (payloadSize <= 125 ) {
193
194
int mask = mask ();
194
195
return allocator
@@ -201,7 +202,7 @@ public ByteBuf createPingFrame(ByteBufAllocator allocator, int payloadSize) {
201
202
}
202
203
203
204
@ Override
204
- public ByteBuf createPongFrame (ByteBufAllocator allocator , int payloadSize ) {
205
+ public final ByteBuf createPongFrame (ByteBufAllocator allocator , int payloadSize ) {
205
206
if (payloadSize <= 125 ) {
206
207
int mask = mask ();
207
208
return allocator
@@ -214,7 +215,7 @@ public ByteBuf createPongFrame(ByteBufAllocator allocator, int payloadSize) {
214
215
}
215
216
216
217
@ Override
217
- public ByteBuf mask (ByteBuf frame ) {
218
+ public final ByteBuf mask (ByteBuf frame ) {
218
219
int maskIndex = frame .readerIndex ();
219
220
int mask = frame .getInt (maskIndex );
220
221
mask (mask , frame , maskIndex + /*mask size*/ 4 , frame .writerIndex ());
@@ -236,46 +237,46 @@ public BulkEncoder bulkEncoder() {
236
237
}
237
238
238
239
@ Override
239
- public ByteBuf encodeBinaryFrame (ByteBuf binaryFrame ) {
240
+ public final ByteBuf encodeBinaryFrame (ByteBuf binaryFrame ) {
240
241
return encodeDataFrame (binaryFrame , BINARY_FRAME_SMALL , BINARY_FRAME_MEDIUM );
241
242
}
242
243
243
244
@ Override
244
- public ByteBuf encodeTextFrame (ByteBuf textFrame ) {
245
+ public final ByteBuf encodeTextFrame (ByteBuf textFrame ) {
245
246
return encodeDataFrame (textFrame , TEXT_FRAME_SMALL , TEXT_FRAME_MEDIUM );
246
247
}
247
248
248
249
@ Override
249
- public ByteBuf encodeBinaryFragmentStart (ByteBuf fragmentFrame ) {
250
+ public final ByteBuf encodeBinaryFragmentStart (ByteBuf fragmentFrame ) {
250
251
return encodeDataFrame (
251
252
fragmentFrame , BINARY_FRAGMENT_START_SMALL , BINARY_FRAGMENT_START_MEDIUM );
252
253
}
253
254
254
255
@ Override
255
- public ByteBuf encodeTextFragmentStart (ByteBuf fragmentFrame ) {
256
+ public final ByteBuf encodeTextFragmentStart (ByteBuf fragmentFrame ) {
256
257
return encodeDataFrame (fragmentFrame , TEXT_FRAGMENT_START_SMALL , TEXT_FRAGMENT_START_MEDIUM );
257
258
}
258
259
259
260
@ Override
260
- public ByteBuf encodeContinuationFragment (ByteBuf fragmentFrame ) {
261
+ public final ByteBuf encodeContinuationFragment (ByteBuf fragmentFrame ) {
261
262
return encodeDataFrame (
262
263
fragmentFrame , DATA_FRAGMENT_CONTINUATION_SMALL , DATA_FRAGMENT_CONTINUATION_MEDIUM );
263
264
}
264
265
265
266
@ Override
266
- public ByteBuf encodeContinuationFragmentEnd (ByteBuf fragmentFrame ) {
267
+ public final ByteBuf encodeContinuationFragmentEnd (ByteBuf fragmentFrame ) {
267
268
return encodeDataFrame (
268
269
fragmentFrame ,
269
270
DATA_FRAGMENT_CONTINUATION_END_SMALL ,
270
271
DATA_FRAGMENT_CONTINUATION_END_MEDIUM );
271
272
}
272
273
273
274
@ Override
274
- public int sizeofFragment (int payloadSize ) {
275
+ public final int sizeofFragment (int payloadSize ) {
275
276
return sizeOfDataFrame (payloadSize );
276
277
}
277
278
278
- ByteBuf encodeDataFrame (ByteBuf binaryFrame , int prefixSmall , int prefixMedium ) {
279
+ final ByteBuf encodeDataFrame (ByteBuf binaryFrame , int prefixSmall , int prefixMedium ) {
279
280
int frameSize = binaryFrame .readableBytes ();
280
281
int smallPrefixSize = 6 ;
281
282
if (frameSize <= 125 + smallPrefixSize ) {
@@ -298,16 +299,17 @@ ByteBuf encodeDataFrame(ByteBuf binaryFrame, int prefixSmall, int prefixMedium)
298
299
}
299
300
300
301
@ Override
301
- public int encodeBinaryFramePrefix (ByteBuf byteBuf , int payloadSize ) {
302
+ public final int encodeBinaryFramePrefix (ByteBuf byteBuf , int payloadSize ) {
302
303
return encodeDataFramePrefix (byteBuf , payloadSize , BINARY_FRAME_SMALL , BINARY_FRAME_MEDIUM );
303
304
}
304
305
305
306
@ Override
306
- public int encodeTextFramePrefix (ByteBuf byteBuf , int textPayloadSize ) {
307
+ public final int encodeTextFramePrefix (ByteBuf byteBuf , int textPayloadSize ) {
307
308
return encodeDataFramePrefix (byteBuf , textPayloadSize , TEXT_FRAME_SMALL , TEXT_FRAME_MEDIUM );
308
309
}
309
310
310
- int encodeDataFramePrefix (ByteBuf byteBuf , int payloadSize , int prefixSmall , int prefixMedium ) {
311
+ final int encodeDataFramePrefix (
312
+ ByteBuf byteBuf , int payloadSize , int prefixSmall , int prefixMedium ) {
311
313
if (payloadSize <= 125 ) {
312
314
int mask = mask ();
313
315
byteBuf .writeShort (prefixSmall | payloadSize );
@@ -324,12 +326,12 @@ int encodeDataFramePrefix(ByteBuf byteBuf, int payloadSize, int prefixSmall, int
324
326
}
325
327
326
328
@ Override
327
- public ByteBuf maskBinaryFrame (ByteBuf byteBuf , int mask , int payloadSize ) {
329
+ public final ByteBuf maskBinaryFrame (ByteBuf byteBuf , int mask , int payloadSize ) {
328
330
return maskDataFrame (byteBuf , mask , payloadSize );
329
331
}
330
332
331
333
@ Override
332
- public ByteBuf maskTextFrame (ByteBuf byteBuf , int mask , int textPayloadSize ) {
334
+ public final ByteBuf maskTextFrame (ByteBuf byteBuf , int mask , int textPayloadSize ) {
333
335
return maskDataFrame (byteBuf , mask , textPayloadSize );
334
336
}
335
337
@@ -340,12 +342,12 @@ static ByteBuf maskDataFrame(ByteBuf byteBuf, int mask, int payloadSize) {
340
342
}
341
343
342
344
@ Override
343
- public int sizeofBinaryFrame (int payloadSize ) {
345
+ public final int sizeofBinaryFrame (int payloadSize ) {
344
346
return sizeOfDataFrame (payloadSize );
345
347
}
346
348
347
349
@ Override
348
- public int sizeofTextFrame (int textPayloadSize ) {
350
+ public final int sizeofTextFrame (int textPayloadSize ) {
349
351
return sizeOfDataFrame (textPayloadSize );
350
352
}
351
353
0 commit comments