List of usage examples for javax.xml.transform.stream StreamSource getReader
public Reader getReader()
From source file:org.springframework.oxm.support.AbstractMarshaller.java
/** * Template method for handling {@code StreamSource}s. * <p>This implementation delegates to {@code unmarshalInputStream} or {@code unmarshalReader}. * @param streamSource the {@code StreamSource} * @return the object graph// w w w. j av a 2 s. com * @throws IOException if an I/O exception occurs * @throws XmlMappingException if the given source cannot be mapped to an object */ protected Object unmarshalStreamSource(StreamSource streamSource) throws XmlMappingException, IOException { if (streamSource.getInputStream() != null) { if (isProcessExternalEntities() && isSupportDtd()) { return unmarshalInputStream(streamSource.getInputStream()); } else { InputSource inputSource = new InputSource(streamSource.getInputStream()); inputSource.setEncoding(getDefaultEncoding()); return unmarshalSaxSource(new SAXSource(inputSource)); } } else if (streamSource.getReader() != null) { if (isProcessExternalEntities() && isSupportDtd()) { return unmarshalReader(streamSource.getReader()); } else { return unmarshalSaxSource(new SAXSource(new InputSource(streamSource.getReader()))); } } else { return unmarshalSaxSource(new SAXSource(new InputSource(streamSource.getSystemId()))); } }