Package org.geowebcache.io

Examples of org.geowebcache.io.Resource.transferTo()


        Resource data = tl.getFeatureInfo(gfiConv, bbox, height, width, x, y);

        try {
            tile.servletResp.setContentType(mimeType.getMimeType());
            ServletOutputStream outputStream = tile.servletResp.getOutputStream();
            data.transferTo(Channels.newChannel(outputStream));
            outputStream.flush();
        } catch (IOException ioe) {
            tile.servletResp.setStatus(500);
            log.error(ioe.getMessage());
        }
View Full Code Here


        if (blob instanceof ByteArrayResource) {
            return ((ByteArrayResource) blob).getContents();
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream((int) blob.getSize());
        try {
            blob.transferTo(Channels.newChannel(out));
            return out.toByteArray();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

            final Resource mapContents = cachedTile.getBlob();
            if (mapContents instanceof ByteArrayResource) {
                tileBytes = ((ByteArrayResource) mapContents).getContents();
            } else {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                mapContents.transferTo(Channels.newChannel(out));
                tileBytes = out.toByteArray();
            }
        }

        // Handle Etags
View Full Code Here

        if (blob instanceof ByteArrayResource) {
            return ((ByteArrayResource) blob).getContents();
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream((int) blob.getSize());
        try {
            blob.transferTo(Channels.newChannel(out));
            return out.toByteArray();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        stats.log(size, CacheResult.OTHER);

        try {
            OutputStream os = convTile.servletResp.getOutputStream();
            data.transferTo(Channels.newChannel(os));
            os.flush();
        } catch (IOException ioe) {
            log.debug("Caught IOException" + ioe.getMessage());
        }
View Full Code Here

        assertNotNull(resource);
        assertEquals(6342, resource.getSize());

        File f = new File("5_12_7.jpg");
        FileOutputStream fos = new FileOutputStream(f);
        resource.transferTo(fos.getChannel());
        fos.close();

        assertTrue(startsWithJPEGHeader(f));

        f.delete();
View Full Code Here

        assertNotNull(resource);
        assertEquals(6308, resource.getSize());

        f = new File("6_25_17.jpg");
        fos = new FileOutputStream(f);
        resource.transferTo(fos.getChannel());
        fos.close();

        assertTrue(startsWithJPEGHeader(f));

        f.delete();
View Full Code Here

        response.setContentLength(size);

        try {
            OutputStream os = response.getOutputStream();
            WritableByteChannel channel = Channels.newChannel(os);
            data.transferTo(channel);
           
            if(stats != null) {
                stats.log(size, conv.getCacheResult());
            }
        } catch (IOException ioe) {
View Full Code Here

        Resource data = tl.getFeatureInfo(gfiConv, bbox, height, width, x, y);

        try {
            tile.servletResp.setContentType(mimeType.getMimeType());
            ServletOutputStream outputStream = tile.servletResp.getOutputStream();
            data.transferTo(Channels.newChannel(outputStream));
            outputStream.flush();
        } catch (IOException ioe) {
            tile.servletResp.setStatus(500);
            log.error(ioe.getMessage());
        }
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.