geronimo-mail_2.1/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/store/imap/connection/IMAPCommand.java [376:424]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected static int encode(byte[] buffer, int count, StringBuffer result) {
        byte b1 = 0;
        byte b2 = 0;
        byte b3 = 0;

        // different processing based on how much we have in the buffer
        switch (count) {
            // ended at a boundary.  This is cool, not much to do.
            case 0:
                // no residual in the buffer
                return 0;

            // just a single left over byte from the last encoding op.
            case 1:
                b1 = buffer[0];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[(b1 << 4) & 0x30]);
                return 0;

            // one complete char to encode
            case 2:
                b1 = buffer[0];
                b2 = buffer[1];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & (0x3c))]);
                return 0;

            // at least a full triplet of bytes to encode
            case 3:
            case 4:
                b1 = buffer[0];
                b2 = buffer[1];
                b3 = buffer[2];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & 0x3c) + ((b3 >>> 6) & 0x03)]);
                result.append(encodingTable[b3 & 0x3f]);

                // if we have more than the triplet, we need to move the extra one into the first
                // position and return the residual indicator
                if (count == 4) {
                    buffer[0] = buffer[4];
                    return 1;
                }
                return 0;
        }
        return 0;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPCommand.java [379:427]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected static int encode(byte[] buffer, int count, StringBuffer result) {
        byte b1 = 0;
        byte b2 = 0;
        byte b3 = 0;

        // different processing based on how much we have in the buffer
        switch (count) {
            // ended at a boundary.  This is cool, not much to do.
            case 0:
                // no residual in the buffer
                return 0;

            // just a single left over byte from the last encoding op.
            case 1:
                b1 = buffer[0];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[(b1 << 4) & 0x30]);
                return 0;

            // one complete char to encode
            case 2:
                b1 = buffer[0];
                b2 = buffer[1];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & (0x3c))]);
                return 0;

            // at least a full triplet of bytes to encode
            case 3:
            case 4:
                b1 = buffer[0];
                b2 = buffer[1];
                b3 = buffer[2];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & 0x3c) + ((b3 >>> 6) & 0x03)]);
                result.append(encodingTable[b3 & 0x3f]);

                // if we have more than the triplet, we need to move the extra one into the first
                // position and return the residual indicator
                if (count == 4) {
                    buffer[0] = buffer[4];
                    return 1;
                }
                return 0;
        }
        return 0;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.5/geronimo-javamail_1.5_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPCommand.java [379:427]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected static int encode(byte[] buffer, int count, StringBuffer result) {
        byte b1 = 0;
        byte b2 = 0;
        byte b3 = 0;

        // different processing based on how much we have in the buffer
        switch (count) {
            // ended at a boundary.  This is cool, not much to do.
            case 0:
                // no residual in the buffer
                return 0;

            // just a single left over byte from the last encoding op.
            case 1:
                b1 = buffer[0];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[(b1 << 4) & 0x30]);
                return 0;

            // one complete char to encode
            case 2:
                b1 = buffer[0];
                b2 = buffer[1];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & (0x3c))]);
                return 0;

            // at least a full triplet of bytes to encode
            case 3:
            case 4:
                b1 = buffer[0];
                b2 = buffer[1];
                b3 = buffer[2];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & 0x3c) + ((b3 >>> 6) & 0x03)]);
                result.append(encodingTable[b3 & 0x3f]);

                // if we have more than the triplet, we need to move the extra one into the first
                // position and return the residual indicator
                if (count == 4) {
                    buffer[0] = buffer[4];
                    return 1;
                }
                return 0;
        }
        return 0;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.6/geronimo-javamail_1.6_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPCommand.java [379:427]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected static int encode(byte[] buffer, int count, StringBuffer result) {
        byte b1 = 0;
        byte b2 = 0;
        byte b3 = 0;

        // different processing based on how much we have in the buffer
        switch (count) {
            // ended at a boundary.  This is cool, not much to do.
            case 0:
                // no residual in the buffer
                return 0;

            // just a single left over byte from the last encoding op.
            case 1:
                b1 = buffer[0];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[(b1 << 4) & 0x30]);
                return 0;

            // one complete char to encode
            case 2:
                b1 = buffer[0];
                b2 = buffer[1];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & (0x3c))]);
                return 0;

            // at least a full triplet of bytes to encode
            case 3:
            case 4:
                b1 = buffer[0];
                b2 = buffer[1];
                b3 = buffer[2];
                result.append(encodingTable[(b1 >>> 2) & 0x3f]);
                result.append(encodingTable[((b1 << 4) & 0x30) + ((b2 >>>4) & 0x0f)]);
                result.append(encodingTable[((b2 << 2) & 0x3c) + ((b3 >>> 6) & 0x03)]);
                result.append(encodingTable[b3 & 0x3f]);

                // if we have more than the triplet, we need to move the extra one into the first
                // position and return the residual indicator
                if (count == 4) {
                    buffer[0] = buffer[4];
                    return 1;
                }
                return 0;
        }
        return 0;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



