@Test public void testRelease() { byte[] bytes1 = "hello".getBytes(); byte[] bytes2 = "hello".getBytes(); ByteBuf buf1 = Unpooled.wrappedBuffer(bytes1); ByteBuf buf2 = Unpooled.wrappedBuffer(bytes2); ByteBuf[] bufs = new ByteBuf[] {buf1, buf2}; DynamicCompositeByteBuf compositeByteBuf = new DynamicCompositeByteBuf(bufs, 0, 2); Assert.assertTrue(buf1.refCnt() == 1); Assert.assertTrue(buf2.refCnt() == 1); compositeByteBuf.release(); Assert.assertTrue(buf1.refCnt() == 0); Assert.assertTrue(buf2.refCnt() == 0); }
public void release() { readableBytes = 0; while (!buffers.isEmpty()) { buffers.remove().release(); } }
DynamicCompositeByteBuf { public void release() { readableBytes = 0; while (!buffers.isEmpty()) { buffers.remove().release(); } } }
DynamicCompositeByteBuf { public void release() { readableBytes = 0; while (!buffers.isEmpty()) { buffers.remove().release(); } } DynamicCompositeByteBuf();  DynamicCompositeByteBuf(int capacity);  DynamicCompositeByteBuf(ByteBuf buf);  DynamicCompositeByteBuf(ByteBuf[] bufs, int offset, int len); }
DynamicCompositeByteBuf { public void release() { readableBytes = 0; while (!buffers.isEmpty()) { buffers.remove().release(); } } DynamicCompositeByteBuf();  DynamicCompositeByteBuf(int capacity);  DynamicCompositeByteBuf(ByteBuf buf);  DynamicCompositeByteBuf(ByteBuf[] bufs, int offset, int len); int readableBytes(); boolean isEmpty(); boolean hasArray(); byte[] array(); int arrayOffset(); int readerIndex(); boolean isReadable(); ByteBuf nettyByteBuf(); void addBuffer(ByteBuf buffer); ByteBuf readRetainedSlice(int length); ByteBuf retainedSlice(int length); void skipBytes(int length); DynamicCompositeByteBuf readBytes(byte[] dst); DynamicCompositeByteBuf readBytes(byte[] dst, int dstIndex, int length); byte readByte(); short readUnsignedByte(); short readShort(); short readShortLE(); int readUnsignedShort(); int readUnsignedShortLE(); int readInt(); int readIntLE(); long readLong(); long readLongLE(); char readChar(); float readFloat(); float readFloatLE(); double readDouble(); double readDoubleLE(); ByteOrder order(); void release(); @Override String toString(); }
DynamicCompositeByteBuf { public void release() { readableBytes = 0; while (!buffers.isEmpty()) { buffers.remove().release(); } } DynamicCompositeByteBuf();  DynamicCompositeByteBuf(int capacity);  DynamicCompositeByteBuf(ByteBuf buf);  DynamicCompositeByteBuf(ByteBuf[] bufs, int offset, int len); int readableBytes(); boolean isEmpty(); boolean hasArray(); byte[] array(); int arrayOffset(); int readerIndex(); boolean isReadable(); ByteBuf nettyByteBuf(); void addBuffer(ByteBuf buffer); ByteBuf readRetainedSlice(int length); ByteBuf retainedSlice(int length); void skipBytes(int length); DynamicCompositeByteBuf readBytes(byte[] dst); DynamicCompositeByteBuf readBytes(byte[] dst, int dstIndex, int length); byte readByte(); short readUnsignedByte(); short readShort(); short readShortLE(); int readUnsignedShort(); int readUnsignedShortLE(); int readInt(); int readIntLE(); long readLong(); long readLongLE(); char readChar(); float readFloat(); float readFloatLE(); double readDouble(); double readDoubleLE(); ByteOrder order(); void release(); @Override String toString();  }