private static InputSource streamSourceToInputSource( StreamSource ss ) { InputSource is = new InputSource(); is.setSystemId( ss.getSystemId() ); is.setByteStream( ss.getInputStream() ); is.setCharacterStream( ss.getReader() ); return is; }
private static InputSource streamSourceToInputSource( StreamSource ss ) { InputSource is = new InputSource(); is.setSystemId( ss.getSystemId() ); is.setByteStream( ss.getInputStream() ); is.setCharacterStream( ss.getReader() ); return is; }
inputSource = new InputSource(streamSource.getSystemId());
return unmarshalSaxSource(new SAXSource(new InputSource(streamSource.getSystemId())));
/** * Attempt to obtain a SAX InputSource object from a Source * object. * * @param source Must be a non-null Source reference. * * @return An InputSource, or null if Source can not be converted. */ public static InputSource sourceToInputSource(Source source) { if (source instanceof SAXSource) { return ((SAXSource) source).getInputSource(); } else if (source instanceof StreamSource) { StreamSource ss = (StreamSource) source; InputSource isource = new InputSource(ss.getSystemId()); isource.setByteStream(ss.getInputStream()); isource.setCharacterStream(ss.getReader()); isource.setPublicId(ss.getPublicId()); return isource; } else { return null; } } }
private static InputSource streamSourceToInputSource( StreamSource ss ) { InputSource is = new InputSource(); is.setSystemId( ss.getSystemId() ); is.setByteStream( ss.getInputStream() ); is.setCharacterStream( ss.getReader() ); return is; }
public XMLStreamReader createXMLStreamReader(Source src) throws XMLStreamException { // Can only support simplest of sources: if (src instanceof StreamSource) { StreamSource ss = (StreamSource) src; InputStream in = ss.getInputStream(); String systemId = ss.getSystemId(); if (in != null) { if (systemId != null) { return createXMLStreamReader(systemId, in); } return createXMLStreamReader(in); } Reader r = ss.getReader(); if (r != null) { if (systemId != null) { return createXMLStreamReader(systemId, r); } return createXMLStreamReader(r); } throw new UnsupportedOperationException("Only those javax.xml.transform.stream.StreamSource instances supported that have an InputStream or Reader"); } throw new UnsupportedOperationException("Only javax.xml.transform.stream.StreamSource type supported"); }
private static WstxInputSource sourceFromSS(WstxInputSource parent, ReaderConfig cfg, String refName, int xmlVersion, StreamSource ssrc) throws IOException, XMLStreamException { InputBootstrapper bs; Reader r = ssrc.getReader(); String pubId = ssrc.getPublicId(); String sysId0 = ssrc.getSystemId(); URL ctxt = (parent == null) ? null : parent.getSource(); URL url = (sysId0 == null || sysId0.length() == 0) ? null : URLUtil.urlFromSystemId(sysId0, ctxt); final SystemId systemId = SystemId.construct(sysId0, (url == null) ? ctxt : url); if (r == null) { InputStream in = ssrc.getInputStream(); if (in == null) { // Need to try just resolving the system id then if (url == null) { throw new IllegalArgumentException("Can not create Stax reader for a StreamSource -- neither reader, input stream nor system id was set."); } in = URLUtil.inputStreamFromURL(url); } bs = StreamBootstrapper.getInstance(pubId, systemId, in); } else { bs = ReaderBootstrapper.getInstance(pubId, systemId, r, null); } Reader r2 = bs.bootstrapInput(cfg, false, xmlVersion); return InputSourceFactory.constructEntitySource (cfg, parent, refName, bs, pubId, systemId, xmlVersion, r2); }
} else if (src instanceof StreamSource) { StreamSource ss = (StreamSource) src; sysId = ss.getSystemId(); pubId = ss.getPublicId(); in = ss.getInputStream();
@SuppressWarnings("WeakerAccess") protected InputStream getInputStream(StreamSource streamSource) { InputStream inputStream = streamSource.getInputStream(); String systemId = streamSource.getSystemId(); if (inputStream != null) { return inputStream; } else if (systemId != null) { return systemIdToStream(systemId); } return null; }
@SuppressWarnings("WeakerAccess") protected InputStream getInputStream(StreamSource streamSource) { InputStream inputStream = streamSource.getInputStream(); String systemId = streamSource.getSystemId(); if (inputStream != null) { return inputStream; } else if (systemId != null) { return systemIdToStream(systemId); } return null; }
private static InputSource streamSourceToInputSource( StreamSource ss ) { InputSource is = new InputSource(); is.setSystemId( ss.getSystemId() ); is.setByteStream( ss.getInputStream() ); is.setCharacterStream( ss.getReader() ); return is; }
private static InputSource streamSourceToInputSource( StreamSource ss ) { InputSource is = new InputSource(); is.setSystemId( ss.getSystemId() ); is.setByteStream( ss.getInputStream() ); is.setCharacterStream( ss.getReader() ); return is; }
private static InputSource streamSourceToInputSource( StreamSource ss ) { InputSource is = new InputSource(); is.setSystemId( ss.getSystemId() ); is.setByteStream( ss.getInputStream() ); is.setCharacterStream( ss.getReader() ); return is; }
protected InputStream getInputStream(StreamSource streamSource) { InputStream inputStream = streamSource.getInputStream(); String systemId = streamSource.getSystemId(); if (inputStream != null) { return inputStream; } else if (systemId != null) { return systemIdToStream(systemId); } return null; }
private static InputSource streamSourceToInputSource( StreamSource ss ) { InputSource is = new InputSource(); is.setSystemId( ss.getSystemId() ); is.setByteStream( ss.getInputStream() ); is.setCharacterStream( ss.getReader() ); return is; }
private static InputSource toInputSource(StreamSource source) { InputSource is = new InputSource(); is.setByteStream(source.getInputStream()); is.setCharacterStream(source.getReader()); is.setPublicId(source.getPublicId()); is.setSystemId(source.getSystemId()); return is; }
private static InputSource toInputSource(StreamSource src) { InputSource is = new InputSource(); is.setByteStream(src.getInputStream()); is.setCharacterStream(src.getReader()); is.setPublicId(src.getPublicId()); is.setSystemId(src.getSystemId()); return is; }
private static InputSource toInputSource(StreamSource src) { InputSource is = new InputSource(); is.setByteStream(src.getInputStream()); is.setCharacterStream(src.getReader()); is.setPublicId(src.getPublicId()); is.setSystemId(src.getSystemId()); return is; }
private static InputSource toInputSource(StreamSource src) { InputSource is = new InputSource(); is.setByteStream(src.getInputStream()); is.setCharacterStream(src.getReader()); is.setPublicId(src.getPublicId()); is.setSystemId(src.getSystemId()); return is; }