private boolean validLowSurrogateAhead(final char ch) throws IOException {
        if (!eof) {
            final int val2 = in.read();
            if (val2 >= 0) {
                final char ch2 = (char) val2;
                readAhead = ch2;
                hasReadAhead = true;

                if (Character.isLowSurrogate(ch2)) {
                    final int supplemental = Character.toCodePoint(ch, ch2);
                    return xmlChars.isValidLiteral(supplemental);
                }
            }
        }
        return false;
    }
An implementation of TransformReader to replace invalid XML (1.0 or 1.1)
characters with the replacement character. The purpose of this class is to
modify character streams (in UTF-16) such as to avoid fatal parse errors
arising in the XML parser.
<p>
The valid XML character ranges are taken from the XML standards documents
available from:
<p>
http://www.w3.org/TR/xml http://www.w3.org/TR/xml11
<p>
SH
stroom-pipeline/src/main/java/stroom/pipeline/reader/InvalidXmlCharFilter.java