Code example for InputSource

Methods: getByteStream, getCharacterStream

0
    } 
 
    public StreamSource toStreamSourceFromSAX(SAXSource source) throws TransformerException {
        InputSource inputSource = source.getInputSource();
        if (inputSource != null) {
            if (inputSource.getCharacterStream() != null) {
                return new StreamSource(inputSource.getCharacterStream());
            } 
            if (inputSource.getByteStream() != null) {
                return new StreamSource(inputSource.getByteStream());
            } 
        } 
        String result = toString(source);
        return new StringSource(result);
    } 
 
    public StreamSource toStreamSourceFromDOM(DOMSource source) throws TransformerException {
        String result = toString(source);
        return new StringSource(result);
    }