Home / Function/ appendPrettyHexDump() — netty Function Reference

appendPrettyHexDump() — netty Function Reference

Architecture documentation for the appendPrettyHexDump() function in ByteBufUtil.java from the netty codebase.

Function java Buffer Search calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  d1e0cafb_0b31_a92a_454a_9ab6c7a82f80["appendPrettyHexDump()"]
  9bc5a946_7621_d763_22b7_e0076aadaab8["HexUtil"]
  d1e0cafb_0b31_a92a_454a_9ab6c7a82f80 -->|defined in| 9bc5a946_7621_d763_22b7_e0076aadaab8
  f2949b79_61ca_8c26_24e9_25d535e9f30e["appendPrettyHexDump()"]
  f2949b79_61ca_8c26_24e9_25d535e9f30e -->|calls| d1e0cafb_0b31_a92a_454a_9ab6c7a82f80
  632b425c_5040_57a9_8906_d675e7ea802e["String()"]
  632b425c_5040_57a9_8906_d675e7ea802e -->|calls| d1e0cafb_0b31_a92a_454a_9ab6c7a82f80
  f2949b79_61ca_8c26_24e9_25d535e9f30e["appendPrettyHexDump()"]
  d1e0cafb_0b31_a92a_454a_9ab6c7a82f80 -->|calls| f2949b79_61ca_8c26_24e9_25d535e9f30e
  a8012bfa_2295_8d6a_cfa9_95215a2aeea8["appendHexDumpRowPrefix()"]
  d1e0cafb_0b31_a92a_454a_9ab6c7a82f80 -->|calls| a8012bfa_2295_8d6a_cfa9_95215a2aeea8
  style d1e0cafb_0b31_a92a_454a_9ab6c7a82f80 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/ByteBufUtil.java lines 1627–1688

        private static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf, int offset, int length) {
            if (isOutOfBounds(offset, length, buf.capacity())) {
                throw new IndexOutOfBoundsException(
                        "expected: " + "0 <= offset(" + offset + ") <= offset + length(" + length
                                                    + ") <= " + "buf.capacity(" + buf.capacity() + ')');
            }
            if (length == 0) {
                return;
            }
            dump.append(
                              "         +-------------------------------------------------+" +
                    NEWLINE + "         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |" +
                    NEWLINE + "+--------+-------------------------------------------------+----------------+");

            final int fullRows = length >>> 4;
            final int remainder = length & 0xF;

            // Dump the rows which have 16 bytes.
            for (int row = 0; row < fullRows; row ++) {
                int rowStartIndex = (row << 4) + offset;

                // Per-row prefix.
                appendHexDumpRowPrefix(dump, row, rowStartIndex);

                // Hex dump
                int rowEndIndex = rowStartIndex + 16;
                for (int j = rowStartIndex; j < rowEndIndex; j ++) {
                    dump.append(BYTE2HEX[buf.getUnsignedByte(j)]);
                }
                dump.append(" |");

                // ASCII dump
                for (int j = rowStartIndex; j < rowEndIndex; j ++) {
                    dump.append(BYTE2CHAR[buf.getUnsignedByte(j)]);
                }
                dump.append('|');
            }

            // Dump the last row which has less than 16 bytes.
            if (remainder != 0) {
                int rowStartIndex = (fullRows << 4) + offset;
                appendHexDumpRowPrefix(dump, fullRows, rowStartIndex);

                // Hex dump
                int rowEndIndex = rowStartIndex + remainder;
                for (int j = rowStartIndex; j < rowEndIndex; j ++) {
                    dump.append(BYTE2HEX[buf.getUnsignedByte(j)]);
                }
                dump.append(HEXPADDING[remainder]);
                dump.append(" |");

                // Ascii dump
                for (int j = rowStartIndex; j < rowEndIndex; j ++) {
                    dump.append(BYTE2CHAR[buf.getUnsignedByte(j)]);
                }
                dump.append(BYTEPADDING[remainder]);
                dump.append('|');
            }

            dump.append(NEWLINE +
                        "+--------+-------------------------------------------------+----------------+");
        }

Domain

Subdomains

Frequently Asked Questions

What does appendPrettyHexDump() do?
appendPrettyHexDump() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java.
Where is appendPrettyHexDump() defined?
appendPrettyHexDump() is defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java at line 1627.
What does appendPrettyHexDump() call?
appendPrettyHexDump() calls 2 function(s): appendHexDumpRowPrefix, appendPrettyHexDump.
What calls appendPrettyHexDump()?
appendPrettyHexDump() is called by 2 function(s): String, appendPrettyHexDump.

Analyze Your Own Codebase

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

Try Supermodel Free