+ Integer.toHexString(c4&0xFF));
c = ((c & 0x7) << 18) | ((c2 & 0x3F) << 12) | ((c3 & 0x3F) << 6) | (c4 & 0x3F);
if (c < 0x10000 || c > 0x10FFFF)
throw new IllegalCharException("Illegal XML character: 0x"
+ Integer.toHexString(c));
// Construct the surrogate pair
c -= 0x10000;
out_buf[out_off + (o++)] = (char)((c >> 10) | 0xD800);
out_buf[out_off + (o++)] = (char)((c & ((1 << 10) - 1)) | 0xDC00);
sawCR = false;
continue;
}
else {
throw new CharConversionException("Characters larger than 4 bytes are "
+ "not supported: byte 0x" + Integer.toHexString(c & 0xFF) + " implies a length of more than 4 bytes");
}
if ( (c >= 0xD800 && c < 0xE000)
|| (c == 0xFFFE || c == 0xFFFF) )
throw new IllegalCharException("Illegal XML character: 0x"
+ Integer.toHexString(c));
}
// Now condense CRLF into LF and transform a lone CR into LF
if (c >= 0x20) {
sawCR = false;
out_buf[out_off + o++] = (char)c;
}
else {
switch (c) {
case '\n':
if (sawCR) {
sawCR = false;
}
else
out_buf[out_off + o++] = '\n';
break;
case '\r':
sawCR = true;
out_buf[out_off + o++] = '\n';
break;
case '\t':
out_buf[out_off + o++] = '\t';
break;
default:
throw new IllegalCharException(
"Illegal XML character: 0x"
+ Integer.toHexString(c));
}
}
}