1 34 35 package org.krysalis.jcharts.encoders; 36 37 38 import org.krysalis.jcharts.Chart; 39 import org.krysalis.jcharts.chartData.ChartDataException; 40 import org.krysalis.jcharts.properties.PropertyException; 41 42 import javax.imageio.ImageIO ; 43 import java.awt.image.BufferedImage ; 44 import java.io.IOException ; 45 import java.io.OutputStream ; 46 47 48 54 public class PNGEncoder 55 { 56 private static final String PNG = "png"; 57 58 59 static 60 { 61 ImageIO.setUseCache( false ); 63 } 64 65 66 70 private PNGEncoder() throws Exception 71 { 72 throw new Exception ( "No need to create an instance of this class!" ); 73 } 74 75 76 86 public static void encode( Chart chart, OutputStream outputStream ) throws ChartDataException, PropertyException, IOException 87 { 88 BufferedImage bufferedImage = BinaryEncoderUtil.render( chart ); 89 ImageIO.write( bufferedImage, PNG, outputStream ); 90 } 91 } 92 | Popular Tags |