*
* @param in the input source with unknown encoding.
*/
public void setInput(InputStream in) throws XMLStreamException {
setInput(in, detectEncoding(in));
CharArray prologEncoding = getCharacterEncodingScheme();
// Checks if necessary to change the reader.
if ((prologEncoding != null) && !prologEncoding.equals(_encoding)
&& !(isUTF8(prologEncoding) && isUTF8(_encoding))) {
// Changes reader (keep characters already read).
int startOffset = _readCount;
reset();
_startOffset = startOffset;
setInput(in, prologEncoding.toString());
}
}