throw new IllegalArgumentException("InputStream must not be null");
try {
String charset = (options != null) ? options.getCharset() : null;
boolean detect = (options != null) ? options.getAutodetectCharset() : true;
if (charset == null && detect) {
FOMSniffingInputStream sin =
(in instanceof FOMSniffingInputStream) ?
(FOMSniffingInputStream)in :
new FOMSniffingInputStream(in);
charset = sin.getEncoding();
in = sin;
}
XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(in);
if (options != null && charset != null) options.setCharset(charset);
FOMFactory factory = getFomFactory(options);