Package org.xhtmlrenderer.util

Examples of org.xhtmlrenderer.util.StreamResource.connect()


     */
    public XMLResource getXMLResource(String uri) {
        String ruri = _uriResolver.resolve(uri);
        StreamResource sr = new StreamResource(ruri);
        try {
            sr.connect();
            BufferedInputStream bis = sr.bufferedStream();
            return XMLResource.load(bis);
        } catch (IOException e) {
            return null;
        } finally {
View Full Code Here


    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) {
View Full Code Here

        } else {
            StreamResource sr = new StreamResource(uri);
            InputStream is;
            ImageResource ir = null;
            try {
                sr.connect();
                is = sr.bufferedStream();
                try {
                    BufferedImage img = ImageIO.read(is);
                    if (img == null) {
                        throw new IOException("ImageIO.read() returned null");
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.