private CloseRequiredInputStream getNativeFormatRemoteStream() throws TileIOException { CloseRequiredInputStream is = null; try { GetTileResponse response = client.getTile( request ); is = response.getAsRawResponse().getAsBinaryStream(); } catch ( Exception e ) { throw new TileIOException( e.getMessage(), e ); } return is; }
/** * Returns the tile as an image. * * @return image, never <code>null</code> * @throws IOException * @throws XMLStreamException * @throws OWSExceptionReport */ public BufferedImage getAsImage() throws IOException, OWSExceptionReport, XMLStreamException { rawResponse.assertNoXmlContentTypeAndExceptionReport(); BufferedImage image = null; try { InputStream is = rawResponse.getAsBinaryStream(); image = HttpUtils.IMAGE.work( is ); } finally { rawResponse.close(); } return image; }