Home / Function/ testGetChunk() — netty Function Reference

testGetChunk() — netty Function Reference

Architecture documentation for the testGetChunk() function in AbstractDiskHttpDataTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  68402eae_2fe7_3365_469c_9832726caff3["testGetChunk()"]
  cf356c02_8114_d186_0de0_149bd7c40a99["AbstractDiskHttpDataTest"]
  68402eae_2fe7_3365_469c_9832726caff3 -->|defined in| cf356c02_8114_d186_0de0_149bd7c40a99
  de85bdcc_afb3_da8b_57fb_627ea00a5520["TestHttpData()"]
  68402eae_2fe7_3365_469c_9832726caff3 -->|calls| de85bdcc_afb3_da8b_57fb_627ea00a5520
  ad6ad2ca_c2ca_3d5f_11e0_6e928ed9abfc["deleteOnExit()"]
  68402eae_2fe7_3365_469c_9832726caff3 -->|calls| ad6ad2ca_c2ca_3d5f_11e0_6e928ed9abfc
  style 68402eae_2fe7_3365_469c_9832726caff3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractDiskHttpDataTest.java lines 39–66

    @Test
    public void testGetChunk() throws Exception {
        TestHttpData test = new TestHttpData("test", UTF_8, 0);
        try {
            File tmpFile = PlatformDependent.createTempFile(UUID.randomUUID().toString(), ".tmp", null);
            tmpFile.deleteOnExit();
            FileOutputStream fos = new FileOutputStream(tmpFile);
            byte[] bytes = new byte[4096];
            ThreadLocalRandom.current().nextBytes(bytes);
            try {
                fos.write(bytes);
                fos.flush();
            } finally {
                fos.close();
            }
            test.setContent(tmpFile);
            ByteBuf buf1 = test.getChunk(1024);
            assertEquals(buf1.readerIndex(), 0);
            assertEquals(buf1.writerIndex(), 1024);
            ByteBuf buf2 = test.getChunk(1024);
            assertEquals(buf2.readerIndex(), 0);
            assertEquals(buf2.writerIndex(), 1024);
            assertFalse(Arrays.equals(ByteBufUtil.getBytes(buf1), ByteBufUtil.getBytes(buf2)),
                    "Arrays should not be equal");
        } finally {
            test.delete();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testGetChunk() do?
testGetChunk() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractDiskHttpDataTest.java.
Where is testGetChunk() defined?
testGetChunk() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractDiskHttpDataTest.java at line 39.
What does testGetChunk() call?
testGetChunk() calls 2 function(s): TestHttpData, deleteOnExit.

Analyze Your Own Codebase

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

Try Supermodel Free