users@jaxb.java.net

Re: Image as Base64

From: Martin Grebac <martin.grebac_at_oracle.com>
Date: Tue, 22 Mar 2011 11:58:43 +0100

PNG is the default, and yes jaxb converts by mimetype,
 MartiNG

On 03/21/2011 02:47 PM, Markus Karg wrote:
>
> So if I understand correctly:
>
>
>
> * Without @XmlMimeType the transferred bytes are of what format? Since
> java.awt.Image has nothing like "getBytes", what does JAXB actually do
> to get the (originally PNG) bytes?
>
>
>
> * With @XmlMimeType the transferred bytes are converted to that
> format? So if I did ImageIO.read(PNG) with @XmlMimeType("image/png")
> JAXB will apply PNG formatting (even if the java.awt.Image maybe was
> loaded from a GIF originally)?
>
>
>
> Thanks!
>
> Markus
>
>
>
> *From:*Wolfgang Laun [mailto:wolfgang.laun_at_gmail.com]
> *Sent:* Montag, 21. März 2011 14:28
> *To:* users_at_jaxb.java.net
> *Subject:* Re: Image as Base64
>
>
>
> On 21 March 2011 14:13, Markus Karg <karg_at_quipsy.de
> <mailto:karg_at_quipsy.de>> wrote:
>
> Wolfgang,
>
>
>
> maybe I am blind, but where on that page does it say that *any*
> Image (possibly PNGs) will be transferred as JPGs?
>
>
> Why should a PNG be transferred as JPG? Whatever you have, as a byte
> array, is transferred. Sender and receiver should have some agreement;
> xmime:expectedContentTypes is the vehicle for that, resulting in a
> @XmlMimeType.
>
> -W
>
>
>
>
>
> Regards
>
> Markus
>
>
>
> *From:*Wolfgang Laun [mailto:wolfgang.laun_at_gmail.com
> <mailto:wolfgang.laun_at_gmail.com>]
> *Sent:* Montag, 21. März 2011 14:08
> *To:* users_at_jaxb.java.net <mailto:users_at_jaxb.java.net>
> *Subject:* Re: Image as Base64
>
>
>
> See the text (and image!) on
> http://jaxb.java.net/tutorial/section_2_2_17-Image-Data.html#Image%20Data
>
> If it has a mime type it should be representable, Java processing
> being available.
>
> -W
>
> On 21 March 2011 13:49, Markus Karg <karg_at_quipsy.de
> <mailto:karg_at_quipsy.de>> wrote:
>
> I just noticed that JAXB is able to deal with java.awt.Image.
> Looks like it uses Base64 to inline it. But I wonder what the
> transferred bytes actuall do present: The raw data of the
> BufferedImage, or a common file format like JPG, PNG, GIF. etc.
> (which one)?
>
>
>
> Thanks
>
> Markus
>
>
>
>
>


-- 
Martin Grebac, GlassFish/Metro/JAXB/Tooling at Oracle
http://blogs.sun.com/mgrebac
ICQ: 93478885