1. 1.如何从BufferedImage对象中获取InputStream对象  
  2. public InputStream getImageStream(String layerName,List<Color> colors,String[] pixels){  
  3.         InputStream is = null;  
  4.           
  5.         BufferedImage bi = createImage(layerName, colors, pixels);  
  6.           
  7.         bi.flush();  
  8.           
  9.         ByteArrayOutputStream bs = new ByteArrayOutputStream();   
  10.           
  11.         ImageOutputStream imOut;  
  12.         try {  
  13.             imOut = ImageIO.createImageOutputStream(bs);  
  14.               
  15.             ImageIO.write(bi, "png",imOut);  
  16.               
  17.             is= new ByteArrayInputStream(bs.toByteArray());  
  18.               
  19.         } catch (IOException e) {  
  20.             e.printStackTrace();  
  21.         }   
  22.         return is;  
  23.     }  
  24.  
  25.