Code example for StreamSource

Methods: getInputStream, getReader

0
     * @return a {@link String} that contains the content of the provided {@link Reader}. 
     * @throws IOException 
     *             in case something bad happens. 
     */ 
    public static String toString(final StreamSource src, final String ecoding) throws IOException {
        Objects.notNull(src);
        InputStream inputStream = src.getInputStream();
        if (inputStream != null) {
            return org.apache.commons.io.IOUtils.toString(inputStream, ecoding);
        } else { 
 
            final Reader r = src.getReader();
            return org.apache.commons.io.IOUtils.toString(r);
        } 
    } 
 
    /** 
     * Convert the input from the provided {@link Reader} into a {@link String}. 
     *  
     * @param inputStream 
     *            the {@link Reader} to copy from.