boolean autoCloseInput;
InputBootstrapper bs = null;
if (src instanceof Stax2Source) {
Stax2Source ss = (Stax2Source) src;
sysId = ss.getSystemId();
pubId = ss.getPublicId();
encoding = ss.getEncoding();
try {
/* 11-Nov-2008, TSa: Let's add optimized handling for byte-block
* source
*/
if (src instanceof Stax2ByteArraySource) {
Stax2ByteArraySource bas = (Stax2ByteArraySource) src;
bs = StreamBootstrapper.getInstance(pubId, sysId, bas.getBuffer(), bas.getBufferStart(), bas.getBufferEnd());
} else {
in = ss.constructInputStream();
if (in == null) {
r = ss.constructReader();
}
}
} catch (IOException ioe) {
throw new WstxIOException(ioe);
}
/* Caller has no direct access to stream/reader, Woodstox
* owns it and thus has to close too
*/
autoCloseInput = true;
} else if (src instanceof StreamSource) {
StreamSource ss = (StreamSource) src;
sysId = ss.getSystemId();
pubId = ss.getPublicId();
in = ss.getInputStream();
if (in == null) {
r = ss.getReader();
}
/* Caller still has access to stream/reader; no need to
* force auto-close-input
*/
autoCloseInput = cfg.willAutoCloseInput();
} else if (src instanceof SAXSource) {
SAXSource ss = (SAXSource) src;
/* 28-Jan-2006, TSa: Not a complete implementation, but maybe
* even this might help...
*/
sysId = ss.getSystemId();
InputSource isrc = ss.getInputSource();
if (isrc != null) {
encoding = isrc.getEncoding();
in = isrc.getByteStream();
if (in == null) {
r = isrc.getCharacterStream();