void copyUcs4ReadBuffer(int count, int shift1, int shift2, int shift3,
            int shift4) throws java.lang.Exception
    {
        int j = readBufferPos;
        int value;

        if (count > 0 && (count % 4) != 0) {
            encodingError(
                    "number of bytes in UCS-4 encoding not divisible by 4", -1,
                    count);
        }
        for (int i = 0; i < count; i += 4) {
            value = (((rawReadBuffer[i] & 0xff) << shift1)
                    | ((rawReadBuffer[i + 1] & 0xff) << shift2)
                    | ((rawReadBuffer[i + 2] & 0xff) << shift3) | ((rawReadBuffer[i + 3] & 0xff) << shift4));
            if (value < 0x0000ffff) {
                readBuffer[j++] = (char) value;
                if (value == (int) '\r') {
                    sawCR = true;
                }
            } else if (value < 0x000fffff) {
                readBuffer[j++] = (char) (0xd8 | ((value & 0x000ffc00) >> 10));
                readBuffer[j++] = (char) (0xdc | (value & 0x0003ff));
            } else {
                encodingError("value cannot be represented in UTF-16", value, i);
            }
        }
        readBufferLength = j;
    }