Home / Function/ testRetainedSlice() — netty Function Reference

testRetainedSlice() — netty Function Reference

Architecture documentation for the testRetainedSlice() function in ReplayingDecoderByteBufTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a53a5951_db25_2003_4607_7027e716fa22["testRetainedSlice()"]
  ef895588_b14f_ef47_4065_265c5001cad2["ReplayingDecoderByteBufTest"]
  a53a5951_db25_2003_4607_7027e716fa22 -->|defined in| ef895588_b14f_ef47_4065_265c5001cad2
  style a53a5951_db25_2003_4607_7027e716fa22 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/test/java/io/netty/handler/codec/ReplayingDecoderByteBufTest.java lines 108–128

    @Test
    void testRetainedSlice() {
        ByteBuf buf = Unpooled.buffer(10);
        int i = 0;
        while (buf.isWritable()) {
            buf.writeByte(i++);
        }
        ReplayingDecoderByteBuf buffer = new ReplayingDecoderByteBuf(buf);
        ByteBuf slice = buffer.retainedSlice(0, 4);
        assertEquals(2, slice.refCnt());

        i = 0;
        while (slice.isReadable()) {
            assertEquals(i++, slice.readByte());
        }
        slice.release();
        buf.release();
        assertEquals(0, slice.refCnt());
        assertEquals(0, buf.refCnt());
        assertEquals(0, buffer.refCnt());
    }

Domain

Subdomains

Frequently Asked Questions

What does testRetainedSlice() do?
testRetainedSlice() is a function in the netty codebase, defined in codec-base/src/test/java/io/netty/handler/codec/ReplayingDecoderByteBufTest.java.
Where is testRetainedSlice() defined?
testRetainedSlice() is defined in codec-base/src/test/java/io/netty/handler/codec/ReplayingDecoderByteBufTest.java at line 108.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free