1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.buffer;
17
18 import io.netty.util.ResourceLeakTracker;
19
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.io.OutputStream;
23 import java.nio.ByteBuffer;
24 import java.nio.ByteOrder;
25 import java.nio.channels.GatheringByteChannel;
26 import java.nio.channels.ScatteringByteChannel;
27 import java.nio.charset.Charset;
28 import java.util.Iterator;
29 import java.util.List;
30
31 import static io.netty.buffer.AdvancedLeakAwareByteBuf.recordLeakNonRefCountingOperation;
32
33 final class AdvancedLeakAwareCompositeByteBuf extends SimpleLeakAwareCompositeByteBuf {
34
35 AdvancedLeakAwareCompositeByteBuf(CompositeByteBuf wrapped, ResourceLeakTracker<ByteBuf> leak) {
36 super(wrapped, leak);
37 }
38
39 @Override
40 public ByteBuf order(ByteOrder endianness) {
41 recordLeakNonRefCountingOperation(leak);
42 return super.order(endianness);
43 }
44
45 @Override
46 public ByteBuf slice() {
47 recordLeakNonRefCountingOperation(leak);
48 return super.slice();
49 }
50
51 @Override
52 public ByteBuf slice(int index, int length) {
53 recordLeakNonRefCountingOperation(leak);
54 return super.slice(index, length);
55 }
56
57 @Override
58 public ByteBuf duplicate() {
59 recordLeakNonRefCountingOperation(leak);
60 return super.duplicate();
61 }
62
63 @Override
64 public ByteBuf readSlice(int length) {
65 recordLeakNonRefCountingOperation(leak);
66 return super.readSlice(length);
67 }
68
69 @Override
70 public CompositeByteBuf discardReadBytes() {
71 recordLeakNonRefCountingOperation(leak);
72 return super.discardReadBytes();
73 }
74
75 @Override
76 public CompositeByteBuf discardSomeReadBytes() {
77 recordLeakNonRefCountingOperation(leak);
78 return super.discardSomeReadBytes();
79 }
80
81 @Override
82 public CompositeByteBuf ensureWritable(int minWritableBytes) {
83 recordLeakNonRefCountingOperation(leak);
84 return super.ensureWritable(minWritableBytes);
85 }
86
87 @Override
88 public int ensureWritable(int minWritableBytes, boolean force) {
89 recordLeakNonRefCountingOperation(leak);
90 return super.ensureWritable(minWritableBytes, force);
91 }
92
93 @Override
94 public boolean getBoolean(int index) {
95 recordLeakNonRefCountingOperation(leak);
96 return super.getBoolean(index);
97 }
98
99 @Override
100 public byte getByte(int index) {
101 recordLeakNonRefCountingOperation(leak);
102 return super.getByte(index);
103 }
104
105 @Override
106 public short getUnsignedByte(int index) {
107 recordLeakNonRefCountingOperation(leak);
108 return super.getUnsignedByte(index);
109 }
110
111 @Override
112 public short getShort(int index) {
113 recordLeakNonRefCountingOperation(leak);
114 return super.getShort(index);
115 }
116
117 @Override
118 public int getUnsignedShort(int index) {
119 recordLeakNonRefCountingOperation(leak);
120 return super.getUnsignedShort(index);
121 }
122
123 @Override
124 public int getMedium(int index) {
125 recordLeakNonRefCountingOperation(leak);
126 return super.getMedium(index);
127 }
128
129 @Override
130 public int getUnsignedMedium(int index) {
131 recordLeakNonRefCountingOperation(leak);
132 return super.getUnsignedMedium(index);
133 }
134
135 @Override
136 public int getInt(int index) {
137 recordLeakNonRefCountingOperation(leak);
138 return super.getInt(index);
139 }
140
141 @Override
142 public long getUnsignedInt(int index) {
143 recordLeakNonRefCountingOperation(leak);
144 return super.getUnsignedInt(index);
145 }
146
147 @Override
148 public long getLong(int index) {
149 recordLeakNonRefCountingOperation(leak);
150 return super.getLong(index);
151 }
152
153 @Override
154 public char getChar(int index) {
155 recordLeakNonRefCountingOperation(leak);
156 return super.getChar(index);
157 }
158
159 @Override
160 public float getFloat(int index) {
161 recordLeakNonRefCountingOperation(leak);
162 return super.getFloat(index);
163 }
164
165 @Override
166 public double getDouble(int index) {
167 recordLeakNonRefCountingOperation(leak);
168 return super.getDouble(index);
169 }
170
171 @Override
172 public CompositeByteBuf getBytes(int index, ByteBuf dst) {
173 recordLeakNonRefCountingOperation(leak);
174 return super.getBytes(index, dst);
175 }
176
177 @Override
178 public CompositeByteBuf getBytes(int index, ByteBuf dst, int length) {
179 recordLeakNonRefCountingOperation(leak);
180 return super.getBytes(index, dst, length);
181 }
182
183 @Override
184 public CompositeByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
185 recordLeakNonRefCountingOperation(leak);
186 return super.getBytes(index, dst, dstIndex, length);
187 }
188
189 @Override
190 public CompositeByteBuf getBytes(int index, byte[] dst) {
191 recordLeakNonRefCountingOperation(leak);
192 return super.getBytes(index, dst);
193 }
194
195 @Override
196 public CompositeByteBuf getBytes(int index, byte[] dst, int dstIndex, int length) {
197 recordLeakNonRefCountingOperation(leak);
198 return super.getBytes(index, dst, dstIndex, length);
199 }
200
201 @Override
202 public CompositeByteBuf getBytes(int index, ByteBuffer dst) {
203 recordLeakNonRefCountingOperation(leak);
204 return super.getBytes(index, dst);
205 }
206
207 @Override
208 public CompositeByteBuf getBytes(int index, OutputStream out, int length) throws IOException {
209 recordLeakNonRefCountingOperation(leak);
210 return super.getBytes(index, out, length);
211 }
212
213 @Override
214 public int getBytes(int index, GatheringByteChannel out, int length) throws IOException {
215 recordLeakNonRefCountingOperation(leak);
216 return super.getBytes(index, out, length);
217 }
218
219 @Override
220 public CompositeByteBuf setBoolean(int index, boolean value) {
221 recordLeakNonRefCountingOperation(leak);
222 return super.setBoolean(index, value);
223 }
224
225 @Override
226 public CompositeByteBuf setByte(int index, int value) {
227 recordLeakNonRefCountingOperation(leak);
228 return super.setByte(index, value);
229 }
230
231 @Override
232 public CompositeByteBuf setShort(int index, int value) {
233 recordLeakNonRefCountingOperation(leak);
234 return super.setShort(index, value);
235 }
236
237 @Override
238 public CompositeByteBuf setMedium(int index, int value) {
239 recordLeakNonRefCountingOperation(leak);
240 return super.setMedium(index, value);
241 }
242
243 @Override
244 public CompositeByteBuf setInt(int index, int value) {
245 recordLeakNonRefCountingOperation(leak);
246 return super.setInt(index, value);
247 }
248
249 @Override
250 public CompositeByteBuf setLong(int index, long value) {
251 recordLeakNonRefCountingOperation(leak);
252 return super.setLong(index, value);
253 }
254
255 @Override
256 public CompositeByteBuf setChar(int index, int value) {
257 recordLeakNonRefCountingOperation(leak);
258 return super.setChar(index, value);
259 }
260
261 @Override
262 public CompositeByteBuf setFloat(int index, float value) {
263 recordLeakNonRefCountingOperation(leak);
264 return super.setFloat(index, value);
265 }
266
267 @Override
268 public CompositeByteBuf setDouble(int index, double value) {
269 recordLeakNonRefCountingOperation(leak);
270 return super.setDouble(index, value);
271 }
272
273 @Override
274 public CompositeByteBuf setBytes(int index, ByteBuf src) {
275 recordLeakNonRefCountingOperation(leak);
276 return super.setBytes(index, src);
277 }
278
279 @Override
280 public CompositeByteBuf setBytes(int index, ByteBuf src, int length) {
281 recordLeakNonRefCountingOperation(leak);
282 return super.setBytes(index, src, length);
283 }
284
285 @Override
286 public CompositeByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
287 recordLeakNonRefCountingOperation(leak);
288 return super.setBytes(index, src, srcIndex, length);
289 }
290
291 @Override
292 public CompositeByteBuf setBytes(int index, byte[] src) {
293 recordLeakNonRefCountingOperation(leak);
294 return super.setBytes(index, src);
295 }
296
297 @Override
298 public CompositeByteBuf setBytes(int index, byte[] src, int srcIndex, int length) {
299 recordLeakNonRefCountingOperation(leak);
300 return super.setBytes(index, src, srcIndex, length);
301 }
302
303 @Override
304 public CompositeByteBuf setBytes(int index, ByteBuffer src) {
305 recordLeakNonRefCountingOperation(leak);
306 return super.setBytes(index, src);
307 }
308
309 @Override
310 public int setBytes(int index, InputStream in, int length) throws IOException {
311 recordLeakNonRefCountingOperation(leak);
312 return super.setBytes(index, in, length);
313 }
314
315 @Override
316 public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException {
317 recordLeakNonRefCountingOperation(leak);
318 return super.setBytes(index, in, length);
319 }
320
321 @Override
322 public CompositeByteBuf setZero(int index, int length) {
323 recordLeakNonRefCountingOperation(leak);
324 return super.setZero(index, length);
325 }
326
327 @Override
328 public boolean readBoolean() {
329 recordLeakNonRefCountingOperation(leak);
330 return super.readBoolean();
331 }
332
333 @Override
334 public byte readByte() {
335 recordLeakNonRefCountingOperation(leak);
336 return super.readByte();
337 }
338
339 @Override
340 public short readUnsignedByte() {
341 recordLeakNonRefCountingOperation(leak);
342 return super.readUnsignedByte();
343 }
344
345 @Override
346 public short readShort() {
347 recordLeakNonRefCountingOperation(leak);
348 return super.readShort();
349 }
350
351 @Override
352 public int readUnsignedShort() {
353 recordLeakNonRefCountingOperation(leak);
354 return super.readUnsignedShort();
355 }
356
357 @Override
358 public int readMedium() {
359 recordLeakNonRefCountingOperation(leak);
360 return super.readMedium();
361 }
362
363 @Override
364 public int readUnsignedMedium() {
365 recordLeakNonRefCountingOperation(leak);
366 return super.readUnsignedMedium();
367 }
368
369 @Override
370 public int readInt() {
371 recordLeakNonRefCountingOperation(leak);
372 return super.readInt();
373 }
374
375 @Override
376 public long readUnsignedInt() {
377 recordLeakNonRefCountingOperation(leak);
378 return super.readUnsignedInt();
379 }
380
381 @Override
382 public long readLong() {
383 recordLeakNonRefCountingOperation(leak);
384 return super.readLong();
385 }
386
387 @Override
388 public char readChar() {
389 recordLeakNonRefCountingOperation(leak);
390 return super.readChar();
391 }
392
393 @Override
394 public float readFloat() {
395 recordLeakNonRefCountingOperation(leak);
396 return super.readFloat();
397 }
398
399 @Override
400 public double readDouble() {
401 recordLeakNonRefCountingOperation(leak);
402 return super.readDouble();
403 }
404
405 @Override
406 public ByteBuf readBytes(int length) {
407 recordLeakNonRefCountingOperation(leak);
408 return super.readBytes(length);
409 }
410
411 @Override
412 public CompositeByteBuf readBytes(ByteBuf dst) {
413 recordLeakNonRefCountingOperation(leak);
414 return super.readBytes(dst);
415 }
416
417 @Override
418 public CompositeByteBuf readBytes(ByteBuf dst, int length) {
419 recordLeakNonRefCountingOperation(leak);
420 return super.readBytes(dst, length);
421 }
422
423 @Override
424 public CompositeByteBuf readBytes(ByteBuf dst, int dstIndex, int length) {
425 recordLeakNonRefCountingOperation(leak);
426 return super.readBytes(dst, dstIndex, length);
427 }
428
429 @Override
430 public CompositeByteBuf readBytes(byte[] dst) {
431 recordLeakNonRefCountingOperation(leak);
432 return super.readBytes(dst);
433 }
434
435 @Override
436 public CompositeByteBuf readBytes(byte[] dst, int dstIndex, int length) {
437 recordLeakNonRefCountingOperation(leak);
438 return super.readBytes(dst, dstIndex, length);
439 }
440
441 @Override
442 public CompositeByteBuf readBytes(ByteBuffer dst) {
443 recordLeakNonRefCountingOperation(leak);
444 return super.readBytes(dst);
445 }
446
447 @Override
448 public CompositeByteBuf readBytes(OutputStream out, int length) throws IOException {
449 recordLeakNonRefCountingOperation(leak);
450 return super.readBytes(out, length);
451 }
452
453 @Override
454 public int readBytes(GatheringByteChannel out, int length) throws IOException {
455 recordLeakNonRefCountingOperation(leak);
456 return super.readBytes(out, length);
457 }
458
459 @Override
460 public CompositeByteBuf skipBytes(int length) {
461 recordLeakNonRefCountingOperation(leak);
462 return super.skipBytes(length);
463 }
464
465 @Override
466 public CompositeByteBuf writeBoolean(boolean value) {
467 recordLeakNonRefCountingOperation(leak);
468 return super.writeBoolean(value);
469 }
470
471 @Override
472 public CompositeByteBuf writeByte(int value) {
473 recordLeakNonRefCountingOperation(leak);
474 return super.writeByte(value);
475 }
476
477 @Override
478 public CompositeByteBuf writeShort(int value) {
479 recordLeakNonRefCountingOperation(leak);
480 return super.writeShort(value);
481 }
482
483 @Override
484 public CompositeByteBuf writeMedium(int value) {
485 recordLeakNonRefCountingOperation(leak);
486 return super.writeMedium(value);
487 }
488
489 @Override
490 public CompositeByteBuf writeInt(int value) {
491 recordLeakNonRefCountingOperation(leak);
492 return super.writeInt(value);
493 }
494
495 @Override
496 public CompositeByteBuf writeLong(long value) {
497 recordLeakNonRefCountingOperation(leak);
498 return super.writeLong(value);
499 }
500
501 @Override
502 public CompositeByteBuf writeChar(int value) {
503 recordLeakNonRefCountingOperation(leak);
504 return super.writeChar(value);
505 }
506
507 @Override
508 public CompositeByteBuf writeFloat(float value) {
509 recordLeakNonRefCountingOperation(leak);
510 return super.writeFloat(value);
511 }
512
513 @Override
514 public CompositeByteBuf writeDouble(double value) {
515 recordLeakNonRefCountingOperation(leak);
516 return super.writeDouble(value);
517 }
518
519 @Override
520 public CompositeByteBuf writeBytes(ByteBuf src) {
521 recordLeakNonRefCountingOperation(leak);
522 return super.writeBytes(src);
523 }
524
525 @Override
526 public CompositeByteBuf writeBytes(ByteBuf src, int length) {
527 recordLeakNonRefCountingOperation(leak);
528 return super.writeBytes(src, length);
529 }
530
531 @Override
532 public CompositeByteBuf writeBytes(ByteBuf src, int srcIndex, int length) {
533 recordLeakNonRefCountingOperation(leak);
534 return super.writeBytes(src, srcIndex, length);
535 }
536
537 @Override
538 public CompositeByteBuf writeBytes(byte[] src) {
539 recordLeakNonRefCountingOperation(leak);
540 return super.writeBytes(src);
541 }
542
543 @Override
544 public CompositeByteBuf writeBytes(byte[] src, int srcIndex, int length) {
545 recordLeakNonRefCountingOperation(leak);
546 return super.writeBytes(src, srcIndex, length);
547 }
548
549 @Override
550 public CompositeByteBuf writeBytes(ByteBuffer src) {
551 recordLeakNonRefCountingOperation(leak);
552 return super.writeBytes(src);
553 }
554
555 @Override
556 public int writeBytes(InputStream in, int length) throws IOException {
557 recordLeakNonRefCountingOperation(leak);
558 return super.writeBytes(in, length);
559 }
560
561 @Override
562 public int writeBytes(ScatteringByteChannel in, int length) throws IOException {
563 recordLeakNonRefCountingOperation(leak);
564 return super.writeBytes(in, length);
565 }
566
567 @Override
568 public CompositeByteBuf writeZero(int length) {
569 recordLeakNonRefCountingOperation(leak);
570 return super.writeZero(length);
571 }
572
573 @Override
574 public int indexOf(int fromIndex, int toIndex, byte value) {
575 recordLeakNonRefCountingOperation(leak);
576 return super.indexOf(fromIndex, toIndex, value);
577 }
578
579 @Override
580 public int bytesBefore(byte value) {
581 recordLeakNonRefCountingOperation(leak);
582 return super.bytesBefore(value);
583 }
584
585 @Override
586 public int bytesBefore(int length, byte value) {
587 recordLeakNonRefCountingOperation(leak);
588 return super.bytesBefore(length, value);
589 }
590
591 @Override
592 public int bytesBefore(int index, int length, byte value) {
593 recordLeakNonRefCountingOperation(leak);
594 return super.bytesBefore(index, length, value);
595 }
596
597 @Override
598 public int forEachByte(ByteBufProcessor processor) {
599 recordLeakNonRefCountingOperation(leak);
600 return super.forEachByte(processor);
601 }
602
603 @Override
604 public int forEachByte(int index, int length, ByteBufProcessor processor) {
605 recordLeakNonRefCountingOperation(leak);
606 return super.forEachByte(index, length, processor);
607 }
608
609 @Override
610 public int forEachByteDesc(ByteBufProcessor processor) {
611 recordLeakNonRefCountingOperation(leak);
612 return super.forEachByteDesc(processor);
613 }
614
615 @Override
616 public int forEachByteDesc(int index, int length, ByteBufProcessor processor) {
617 recordLeakNonRefCountingOperation(leak);
618 return super.forEachByteDesc(index, length, processor);
619 }
620
621 @Override
622 public ByteBuf copy() {
623 recordLeakNonRefCountingOperation(leak);
624 return super.copy();
625 }
626
627 @Override
628 public ByteBuf copy(int index, int length) {
629 recordLeakNonRefCountingOperation(leak);
630 return super.copy(index, length);
631 }
632
633 @Override
634 public int nioBufferCount() {
635 recordLeakNonRefCountingOperation(leak);
636 return super.nioBufferCount();
637 }
638
639 @Override
640 public ByteBuffer nioBuffer() {
641 recordLeakNonRefCountingOperation(leak);
642 return super.nioBuffer();
643 }
644
645 @Override
646 public ByteBuffer nioBuffer(int index, int length) {
647 recordLeakNonRefCountingOperation(leak);
648 return super.nioBuffer(index, length);
649 }
650
651 @Override
652 public ByteBuffer[] nioBuffers() {
653 recordLeakNonRefCountingOperation(leak);
654 return super.nioBuffers();
655 }
656
657 @Override
658 public ByteBuffer[] nioBuffers(int index, int length) {
659 recordLeakNonRefCountingOperation(leak);
660 return super.nioBuffers(index, length);
661 }
662
663 @Override
664 public ByteBuffer internalNioBuffer(int index, int length) {
665 recordLeakNonRefCountingOperation(leak);
666 return super.internalNioBuffer(index, length);
667 }
668
669 @Override
670 public String toString(Charset charset) {
671 recordLeakNonRefCountingOperation(leak);
672 return super.toString(charset);
673 }
674
675 @Override
676 public String toString(int index, int length, Charset charset) {
677 recordLeakNonRefCountingOperation(leak);
678 return super.toString(index, length, charset);
679 }
680
681 @Override
682 public CompositeByteBuf capacity(int newCapacity) {
683 recordLeakNonRefCountingOperation(leak);
684 return super.capacity(newCapacity);
685 }
686
687 @Override
688 public CompositeByteBuf addComponent(ByteBuf buffer) {
689 recordLeakNonRefCountingOperation(leak);
690 return super.addComponent(buffer);
691 }
692
693 @Override
694 public CompositeByteBuf addComponents(ByteBuf... buffers) {
695 recordLeakNonRefCountingOperation(leak);
696 return super.addComponents(buffers);
697 }
698
699 @Override
700 public CompositeByteBuf addComponents(Iterable<ByteBuf> buffers) {
701 recordLeakNonRefCountingOperation(leak);
702 return super.addComponents(buffers);
703 }
704
705 @Override
706 public CompositeByteBuf addComponent(int cIndex, ByteBuf buffer) {
707 recordLeakNonRefCountingOperation(leak);
708 return super.addComponent(cIndex, buffer);
709 }
710
711 @Override
712 public CompositeByteBuf addComponents(int cIndex, ByteBuf... buffers) {
713 recordLeakNonRefCountingOperation(leak);
714 return super.addComponents(cIndex, buffers);
715 }
716
717 @Override
718 public CompositeByteBuf addComponents(int cIndex, Iterable<ByteBuf> buffers) {
719 recordLeakNonRefCountingOperation(leak);
720 return super.addComponents(cIndex, buffers);
721 }
722
723 @Override
724 public CompositeByteBuf addComponent(boolean increaseWriterIndex, ByteBuf buffer) {
725 recordLeakNonRefCountingOperation(leak);
726 return super.addComponent(increaseWriterIndex, buffer);
727 }
728
729 @Override
730 public CompositeByteBuf addComponents(boolean increaseWriterIndex, ByteBuf... buffers) {
731 recordLeakNonRefCountingOperation(leak);
732 return super.addComponents(increaseWriterIndex, buffers);
733 }
734
735 @Override
736 public CompositeByteBuf addComponents(boolean increaseWriterIndex, Iterable<ByteBuf> buffers) {
737 recordLeakNonRefCountingOperation(leak);
738 return super.addComponents(increaseWriterIndex, buffers);
739 }
740
741 @Override
742 public CompositeByteBuf addComponent(boolean increaseWriterIndex, int cIndex, ByteBuf buffer) {
743 recordLeakNonRefCountingOperation(leak);
744 return super.addComponent(increaseWriterIndex, cIndex, buffer);
745 }
746
747 @Override
748 public CompositeByteBuf removeComponent(int cIndex) {
749 recordLeakNonRefCountingOperation(leak);
750 return super.removeComponent(cIndex);
751 }
752
753 @Override
754 public CompositeByteBuf removeComponents(int cIndex, int numComponents) {
755 recordLeakNonRefCountingOperation(leak);
756 return super.removeComponents(cIndex, numComponents);
757 }
758
759 @Override
760 public Iterator<ByteBuf> iterator() {
761 recordLeakNonRefCountingOperation(leak);
762 return super.iterator();
763 }
764
765 @Override
766 public List<ByteBuf> decompose(int offset, int length) {
767 recordLeakNonRefCountingOperation(leak);
768 return super.decompose(offset, length);
769 }
770
771 @Override
772 public CompositeByteBuf consolidate() {
773 recordLeakNonRefCountingOperation(leak);
774 return super.consolidate();
775 }
776
777 @Override
778 public CompositeByteBuf discardReadComponents() {
779 recordLeakNonRefCountingOperation(leak);
780 return super.discardReadComponents();
781 }
782
783 @Override
784 public CompositeByteBuf consolidate(int cIndex, int numComponents) {
785 recordLeakNonRefCountingOperation(leak);
786 return super.consolidate(cIndex, numComponents);
787 }
788
789 @Override
790 public CompositeByteBuf retain() {
791 leak.record();
792 return super.retain();
793 }
794
795 @Override
796 public CompositeByteBuf retain(int increment) {
797 leak.record();
798 return super.retain(increment);
799 }
800
801 @Override
802 public boolean release() {
803 leak.record();
804 return super.release();
805 }
806
807 @Override
808 public boolean release(int decrement) {
809 leak.record();
810 return super.release(decrement);
811 }
812
813 @Override
814 protected AdvancedLeakAwareByteBuf newLeakAwareByteBuf(
815 ByteBuf wrapped, ByteBuf trackedByteBuf, ResourceLeakTracker<ByteBuf> leakTracker) {
816 return new AdvancedLeakAwareByteBuf(wrapped, trackedByteBuf, leakTracker);
817 }
818 }