Home / Function/ testRenameTo() — netty Function Reference

testRenameTo() — netty Function Reference

Architecture documentation for the testRenameTo() function in AbstractMemoryHttpDataTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  fdc5e253_7006_e873_2db6_b22045254ef9["testRenameTo()"]
  3b2d0623_5311_2698_e2c8_4ff0f0e583b8["AbstractMemoryHttpDataTest"]
  fdc5e253_7006_e873_2db6_b22045254ef9 -->|defined in| 3b2d0623_5311_2698_e2c8_4ff0f0e583b8
  54414378_073c_cece_2b86_2b81f7995c83["TestHttpData()"]
  fdc5e253_7006_e873_2db6_b22045254ef9 -->|calls| 54414378_073c_cece_2b86_2b81f7995c83
  style fdc5e253_7006_e873_2db6_b22045254ef9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java lines 73–105

    @Test
    public void testRenameTo() throws Exception {
        TestHttpData test = new TestHttpData("test", UTF_8, 0);
        try {
            File tmpFile = PlatformDependent.createTempFile(UUID.randomUUID().toString(), ".tmp", null);
            tmpFile.deleteOnExit();
            final int totalByteCount = 4096;
            byte[] bytes = new byte[totalByteCount];
            ThreadLocalRandom.current().nextBytes(bytes);
            ByteBuf content = Unpooled.wrappedBuffer(bytes);
            test.setContent(content);
            boolean succ = test.renameTo(tmpFile);
            assertTrue(succ);
            try (FileInputStream fis = new FileInputStream(tmpFile)) {
                byte[] buf = new byte[totalByteCount];
                int count = 0;
                int offset = 0;
                int size = totalByteCount;
                while ((count = fis.read(buf, offset, size)) > 0) {
                    offset += count;
                    size -= count;
                    if (offset >= totalByteCount || size <= 0) {
                        break;
                    }
                }
                assertArrayEquals(bytes, buf);
                assertEquals(0, fis.available());
            }
        } finally {
            //release the ByteBuf in AbstractMemoryHttpData
            test.delete();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testRenameTo() do?
testRenameTo() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java.
Where is testRenameTo() defined?
testRenameTo() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java at line 73.
What does testRenameTo() call?
testRenameTo() calls 1 function(s): TestHttpData.

Analyze Your Own Codebase

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

Try Supermodel Free