Examples of StreamResource


Examples of org.xhtmlrenderer.util.StreamResource

        }
    }

    public byte[] getBinaryResource(String uri) {
        String ruri = _uriResolver.resolve(uri);
        StreamResource sr = new StreamResource(ruri);
        try {
            sr.connect();
            BufferedInputStream bis = sr.bufferedStream();
            ByteArrayOutputStream result = new ByteArrayOutputStream(sr.hasStreamLength() ? sr.streamLength() : 4 * 1024);
            byte[] buf = new byte[10240];
            int i;
            while ((i = bis.read(buf)) != -1) {
                result.write(buf, 0, i);
            }

            return result.toByteArray();
        } catch (IOException e) {
            return null;
        } finally {
            sr.close();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.