Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!cs.uu.nl!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: is that possible to include a small PNG file as part of Java class? Date: Tue, 24 Jun 2014 16:00:29 -0400 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: <1brhcp5gdqr4.1ah31etxt4x8u.dlg@40tude.net> <8gz583tqrh2g.1eh9m8c46qwfn.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 24 Jun 2014 20:06:17 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="b896cb427f8c4d19d14880347aa9d6ce"; logging-data="23416"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+A7/EadJhENobJ0p6bRadNwQcmy817S/I=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.6.0 In-Reply-To: <8gz583tqrh2g.1eh9m8c46qwfn.dlg@40tude.net> Cancel-Lock: sha1:/b2904FoOnoq1IUsSS0LtSgOX7k= Xref: csiph.com comp.lang.java.programmer:28843 On 06/23/2014 04:08 PM, Joerg Meier wrote: >> JDK 8 has java.util.Base64, that will make your example different. > > Is there any reason to use that over the already existing DatatypeConverter > .printBase64Binary ? > Actually, the examples I've posted down thread contain a potential bug. In them I've used Base64.getMimeEncoder()* which uses the alphabet in Table 1 of RFC 4648 and includes the plus and backslash characters which depending how you use the Strings might cause problems. Using Base64.getUrlEncoder() is likely safer, as it uses the alphabet in Table 2, the so called "URL and Filename safe" Base 64 Alphabet. Thus a potential reason to prefer Base64 over DatatypeConverter. *my motivation was the auto line wrapping.