Home / Function/ testReadLine() — netty Function Reference

testReadLine() — netty Function Reference

Architecture documentation for the testReadLine() function in ByteBufStreamTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f0bc0266_9158_ddf5_2d63_156e338e180a["testReadLine()"]
  a5486ee2_8de3_00d9_5697_f3849d26246a["ByteBufStreamTest"]
  f0bc0266_9158_ddf5_2d63_156e338e180a -->|defined in| a5486ee2_8de3_00d9_5697_f3849d26246a
  style f0bc0266_9158_ddf5_2d63_156e338e180a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/ByteBufStreamTest.java lines 191–227

    @Test
    public void testReadLine() throws Exception {
        Charset utf8 = StandardCharsets.UTF_8;
        ByteBuf buf = Unpooled.buffer();
        ByteBufInputStream in = new ByteBufInputStream(buf, true);

        String s = in.readLine();
        assertNull(s);
        in.close();

        ByteBuf buf2 = Unpooled.buffer();
        int charCount = 7; //total chars in the string below without new line characters
        byte[] abc = "\na\n\nb\r\nc\nd\ne".getBytes(utf8);
        buf2.writeBytes(abc);

        ByteBufInputStream in2 = new ByteBufInputStream(buf2, true);
        in2.mark(charCount);
        assertEquals("", in2.readLine());
        assertEquals("a", in2.readLine());
        assertEquals("", in2.readLine());
        assertEquals("b", in2.readLine());
        assertEquals("c", in2.readLine());
        assertEquals("d", in2.readLine());
        assertEquals("e", in2.readLine());
        assertNull(in.readLine());

        in2.reset();
        int count = 0;
        while (in2.readLine() != null) {
            ++count;
            if (count > charCount) {
                fail("readLine() should have returned null");
            }
        }
        assertEquals(charCount, count);
        in2.close();
    }

Domain

Subdomains

Frequently Asked Questions

What does testReadLine() do?
testReadLine() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/ByteBufStreamTest.java.
Where is testReadLine() defined?
testReadLine() is defined in buffer/src/test/java/io/netty/buffer/ByteBufStreamTest.java at line 191.

Analyze Your Own Codebase

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

Try Supermodel Free