2 Replies Latest reply on Jan 15, 2009 1:15 PM by Nick Belaevski

    problem in displaying byte data in a4j:mediaOutput

    Ahmet temiz Novice

      hello

      I examined a4j:mediaOutput example in RichFaces site.

      I want to display an image in byte[] type --imgByt2--.

      how can I do that ?

      here is my code:
      ~~~~~~~~~~~~~~~~~~~~
      public void paint(OutputStream out, Object data) throws IOException {
      byte[] imgByt2 = null;

      ImageData2 paintData;
      paintData = new ImageData2();

      imgByt2 = paintData.imgBytes; // I want to show this byte data as an image

      BufferedImage img = new BufferedImage(paintData.getWidth(),
      paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
      Graphics2D graphics2D = img.createGraphics();

      //graphics2D.drawChars(new String("RichFaces").toCharArray(),0,9,40,15);

      ImageIO.write(img, "jpeg", out); where can I put byte data ---imgByt2 --?
      ~~~~~~~~~~~~~~~

      regards