Home / Function/ testTruncated() — netty Function Reference

testTruncated() — netty Function Reference

Architecture documentation for the testTruncated() function in DefaultFileRegionTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ce1dd54c_9c7d_fa01_70f2_0f17e92b8064["testTruncated()"]
  4827225f_a470_f31a_244d_0b1a22a04604["DefaultFileRegionTest"]
  ce1dd54c_9c7d_fa01_70f2_0f17e92b8064 -->|defined in| 4827225f_a470_f31a_244d_0b1a22a04604
  style ce1dd54c_9c7d_fa01_70f2_0f17e92b8064 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/DefaultFileRegionTest.java lines 85–111

    @Test
    public void testTruncated() throws IOException  {
        File file = newFile();
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        try (WritableByteChannel channel = Channels.newChannel(outputStream);
             RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw")) {
            FileRegion region = new DefaultFileRegion(randomAccessFile.getChannel(), 0, data.length);

            randomAccessFile.getChannel().truncate(data.length - 1024);

            assertEquals(data.length, region.count());
            assertEquals(0, region.transferred());

            assertEquals(data.length - 1024, region.transferTo(channel, 0));
            assertEquals(data.length, region.count());
            assertEquals(data.length - 1024, region.transferred());
            try {
                region.transferTo(channel, data.length - 1024);
                fail();
            } catch (IOException expected) {
                // expected
            }
        } finally {
            file.delete();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testTruncated() do?
testTruncated() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/DefaultFileRegionTest.java.
Where is testTruncated() defined?
testTruncated() is defined in transport/src/test/java/io/netty/channel/DefaultFileRegionTest.java at line 85.

Analyze Your Own Codebase

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

Try Supermodel Free