Home / Class/ ByteProcessorTest Class — netty Architecture

ByteProcessorTest Class — netty Architecture

Architecture documentation for the ByteProcessorTest class in ByteProcessorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  dce3cb04_7a4b_2c0b_e436_07fb91534331["ByteProcessorTest"]
  dbb2b371_0cd2_a6ee_a63d_f740482746e5["ByteProcessorTest.java"]
  dce3cb04_7a4b_2c0b_e436_07fb91534331 -->|defined in| dbb2b371_0cd2_a6ee_a63d_f740482746e5
  6b84c6ec_80dc_79f7_f009_8977e2f801f9["testForward()"]
  dce3cb04_7a4b_2c0b_e436_07fb91534331 -->|method| 6b84c6ec_80dc_79f7_f009_8977e2f801f9
  aa9b3a57_f28e_553f_cf65_3f301b92c527["testBackward()"]
  dce3cb04_7a4b_2c0b_e436_07fb91534331 -->|method| aa9b3a57_f28e_553f_cf65_3f301b92c527

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/ByteProcessorTest.java lines 25–69

public class ByteProcessorTest {
    @Test
    public void testForward() {
        final ByteBuf buf =
                Unpooled.copiedBuffer("abc\r\n\ndef\r\rghi\n\njkl\0\0mno  \t\tx", CharsetUtil.ISO_8859_1);
        final int length = buf.readableBytes();

        assertEquals(3,  buf.forEachByte(0,  length, ByteProcessor.FIND_CRLF));
        assertEquals(6,  buf.forEachByte(3,  length - 3, ByteProcessor.FIND_NON_CRLF));
        assertEquals(9,  buf.forEachByte(6,  length - 6, ByteProcessor.FIND_CR));
        assertEquals(11, buf.forEachByte(9,  length - 9, ByteProcessor.FIND_NON_CR));
        assertEquals(14, buf.forEachByte(11, length - 11, ByteProcessor.FIND_LF));
        assertEquals(16, buf.forEachByte(14, length - 14, ByteProcessor.FIND_NON_LF));
        assertEquals(19, buf.forEachByte(16, length - 16, ByteProcessor.FIND_NUL));
        assertEquals(21, buf.forEachByte(19, length - 19, ByteProcessor.FIND_NON_NUL));
        assertEquals(24, buf.forEachByte(19, length - 19, ByteProcessor.FIND_ASCII_SPACE));
        assertEquals(24, buf.forEachByte(21, length - 21, ByteProcessor.FIND_LINEAR_WHITESPACE));
        assertEquals(28, buf.forEachByte(24, length - 24, ByteProcessor.FIND_NON_LINEAR_WHITESPACE));
        assertEquals(-1, buf.forEachByte(28, length - 28, ByteProcessor.FIND_LINEAR_WHITESPACE));

        buf.release();
    }

    @Test
    public void testBackward() {
        final ByteBuf buf =
                Unpooled.copiedBuffer("abc\r\n\ndef\r\rghi\n\njkl\0\0mno  \t\tx", CharsetUtil.ISO_8859_1);
        final int length = buf.readableBytes();

        assertEquals(27, buf.forEachByteDesc(0, length, ByteProcessor.FIND_LINEAR_WHITESPACE));
        assertEquals(25, buf.forEachByteDesc(0, length, ByteProcessor.FIND_ASCII_SPACE));
        assertEquals(23, buf.forEachByteDesc(0, 28, ByteProcessor.FIND_NON_LINEAR_WHITESPACE));
        assertEquals(20, buf.forEachByteDesc(0, 24, ByteProcessor.FIND_NUL));
        assertEquals(18, buf.forEachByteDesc(0, 21, ByteProcessor.FIND_NON_NUL));
        assertEquals(15, buf.forEachByteDesc(0, 19, ByteProcessor.FIND_LF));
        assertEquals(13, buf.forEachByteDesc(0, 16, ByteProcessor.FIND_NON_LF));
        assertEquals(10, buf.forEachByteDesc(0, 14, ByteProcessor.FIND_CR));
        assertEquals(8,  buf.forEachByteDesc(0, 11, ByteProcessor.FIND_NON_CR));
        assertEquals(5,  buf.forEachByteDesc(0, 9, ByteProcessor.FIND_CRLF));
        assertEquals(2,  buf.forEachByteDesc(0, 6, ByteProcessor.FIND_NON_CRLF));
        assertEquals(-1, buf.forEachByteDesc(0, 3, ByteProcessor.FIND_CRLF));

        buf.release();
    }
}

Frequently Asked Questions

What is the ByteProcessorTest class?
ByteProcessorTest is a class in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/ByteProcessorTest.java.
Where is ByteProcessorTest defined?
ByteProcessorTest is defined in buffer/src/test/java/io/netty/buffer/ByteProcessorTest.java at line 25.

Analyze Your Own Codebase

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

Try Supermodel Free