Hi all,

>From a web service I am receiving a byte array that represents a
image.
I need to somehow squeeze this byte array into a image widget or
similar widget on my client side.

First I tried to convert the byte array to a base64 string:
String base64 = Base64Utils.toBase64(image);
base64 = "data:image/png;base64,"+base64;

This didn't work. The developer of the web service informed me that I
should not convert the byte array to a base64 string, and just use it
directly.

To test if the byte array represented a correct image, I saved the
byte array to a physical image:
InputStream in = new ByteArrayInputStream(image);
BufferedImage bImage = ImageIO.read(in);

File outputfile = new File("saved.png");
ImageIO.write(bImage, "png", outputfile);

This succesfully resulted in a physical image being created.

However I don't want to write the file and then send the URL to the
image widget on my client side.

Anybody have any suggestion about how I can get this byte array
squeezed into a image?
Or convert this byte array to a base64 string that does work?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to