protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
            int b,c;
            int remaining = in.remaining();
            while (remaining-- > 0) {
                if (out.remaining() < 1)
                    return CoderResult.OVERFLOW;
                b = in.get();
                if (b == ESCAPE) {
                    if (remaining-- == 0) {
                        in.position(in.position() - 1);
                        return CoderResult.UNDERFLOW;
                    }
                    b = in.get();
                    c = BYTE_TO_CHAR_ESCAPED[b & 0xFF];
                } else {
                    c = BYTE_TO_CHAR[b & 0xFF];
                }

                if (c == -1) {
                    in.position(in.position() - 1);
                    return CoderResult.malformedForLength(1);
                }
                out.put((char)c);
            }

            return CoderResult.UNDERFLOW;
        }