/** * @param legend a {@link BufferedImageLegendGraphic} * @param output destination for the image written by {@link ImageIO} in the {@link * #getContentType() supported format} * @see Response#write(Object, OutputStream, Operation) */ @Override public void write(Object legend, OutputStream output, Operation operation) throws IOException, ServiceException { Assert.isInstanceOf(BufferedImageLegendGraphic.class, legend); BufferedImage legendImage = ((BufferedImageLegendGraphic) legend).getLegend(); JAISupport.encode(JPEGLegendOutputFormat.MIME_TYPE, legendImage, output); }