Home / Function/ encode3to4() — netty Function Reference

encode3to4() — netty Function Reference

Architecture documentation for the encode3to4() function in Base64.java from the netty codebase.

Function java CodecBase Serialization calls 5 called by 1

Entity Profile

Dependency Diagram

graph TD
  7551fd15_5173_2a99_6a2e_fbfda3e91ed1["encode3to4()"]
  185f00a4_bc52_6a3f_9287_a20b3809bf29["Base64"]
  7551fd15_5173_2a99_6a2e_fbfda3e91ed1 -->|defined in| 185f00a4_bc52_6a3f_9287_a20b3809bf29
  da3cd2e3_2c14_e7b9_1203_5535883263df["ByteBuf()"]
  da3cd2e3_2c14_e7b9_1203_5535883263df -->|calls| 7551fd15_5173_2a99_6a2e_fbfda3e91ed1
  8eb02fd8_9511_e138_cf9c_6693ab98ec58["toInt()"]
  7551fd15_5173_2a99_6a2e_fbfda3e91ed1 -->|calls| 8eb02fd8_9511_e138_cf9c_6693ab98ec58
  6245dd21_9bb5_0721_5376_f09d4f8174b9["toIntBE()"]
  7551fd15_5173_2a99_6a2e_fbfda3e91ed1 -->|calls| 6245dd21_9bb5_0721_5376_f09d4f8174b9
  17882ff8_ea90_bf2d_118f_81fad4d75770["encode3to4BigEndian()"]
  7551fd15_5173_2a99_6a2e_fbfda3e91ed1 -->|calls| 17882ff8_ea90_bf2d_118f_81fad4d75770
  6174e888_2c16_9857_2fbd_870cebe264c2["toIntLE()"]
  7551fd15_5173_2a99_6a2e_fbfda3e91ed1 -->|calls| 6174e888_2c16_9857_2fbd_870cebe264c2
  ab863a79_b507_5845_6e6a_0ab6914875a1["encode3to4LittleEndian()"]
  7551fd15_5173_2a99_6a2e_fbfda3e91ed1 -->|calls| ab863a79_b507_5845_6e6a_0ab6914875a1
  style 7551fd15_5173_2a99_6a2e_fbfda3e91ed1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/main/java/io/netty/handler/codec/base64/Base64.java lines 175–218

    private static int encode3to4(
            ByteBuf src, int srcOffset, int numSigBytes, ByteBuf dest, int destOffset, byte[] alphabet,
            boolean addPadding) {
        //           1         2         3
        // 01234567890123456789012345678901 Bit position
        // --------000000001111111122222222 Array position from threeBytes
        // --------|    ||    ||    ||    | Six bit groups to index ALPHABET
        //          >>18  >>12  >> 6  >> 0  Right shift necessary
        //                0x3f  0x3f  0x3f  Additional AND

        // Create buffer with zero-padding if there are only one or two
        // significant bytes passed in the array.
        // We have to shift left 24 in order to flush out the 1's that appear
        // when Java treats a value as negative that is cast from a byte to an int.
        if (src.order() == ByteOrder.BIG_ENDIAN) {
            final int inBuff;
            switch (numSigBytes) {
                case 1:
                    inBuff = toInt(src.getByte(srcOffset));
                    break;
                case 2:
                    inBuff = toIntBE(src.getShort(srcOffset));
                    break;
                default:
                    inBuff = numSigBytes <= 0 ? 0 : toIntBE(src.getMedium(srcOffset));
                    break;
            }
            return encode3to4BigEndian(inBuff, numSigBytes, dest, destOffset, alphabet, addPadding);
        } else {
            final int inBuff;
            switch (numSigBytes) {
                case 1:
                    inBuff = toInt(src.getByte(srcOffset));
                    break;
                case 2:
                    inBuff = toIntLE(src.getShort(srcOffset));
                    break;
                default:
                    inBuff = numSigBytes <= 0 ? 0 : toIntLE(src.getMedium(srcOffset));
                    break;
            }
            return encode3to4LittleEndian(inBuff, numSigBytes, dest, destOffset, alphabet, addPadding);
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does encode3to4() do?
encode3to4() is a function in the netty codebase, defined in codec-base/src/main/java/io/netty/handler/codec/base64/Base64.java.
Where is encode3to4() defined?
encode3to4() is defined in codec-base/src/main/java/io/netty/handler/codec/base64/Base64.java at line 175.
What does encode3to4() call?
encode3to4() calls 5 function(s): encode3to4BigEndian, encode3to4LittleEndian, toInt, toIntBE, toIntLE.
What calls encode3to4()?
encode3to4() is called by 1 function(s): ByteBuf.

Analyze Your Own Codebase

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

Try Supermodel Free