Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

sun.misc.base64

Thread view: 
Janna - 20 Dec 2007 12:54 GMT
Can anyone tell me what jar or package I need to include sun.misc.Base64.*
dependencies? I want to use this package in an application being developed
in Eclipse, but I don;t know where it exists (This has to be developed under
JDK 1.4.2). Thanks guys.
Marcelo Morales - 20 Dec 2007 22:41 GMT
> Can anyone tell me what jar or package I need to include sun.misc.Base64.*
> dependencies? I want to use this package in an application being developed
> in Eclipse, but I don;t know where it exists (This has to be developed under
> JDK 1.4.2). Thanks guys.

On the JDK 1.4.2, both sun/misc/BASE64Encoder and sun/misc/
BASE64Decoder come in the standard distribution, on a jarfile called
classes.jar.

However... you should not rely on these classes. See:

http://java.sun.com/products/jdk/faq/faq-sun-packages.html

Maybe other JREs don't include such classes.... ibm? gcj? ..

Try something like apache jakarta commons codec for a ever compatible
implementation for Base64.

Best regards.
Roedy Green - 21 Dec 2007 00:27 GMT
>Can anyone tell me what jar or package I need to include sun.misc.Base64.*
>dependencies? I want to use this package in an application being developed
>in Eclipse, but I don;t know where it exists (This has to be developed under
>JDK 1.4.2). Thanks guys.

See http://mindprod.com/jgloss/base64.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Sabine Dinis Blochberger - 21 Dec 2007 09:34 GMT
> >Can anyone tell me what jar or package I need to include sun.misc.Base64.*
> >dependencies? I want to use this package in an application being developed
> >in Eclipse, but I don;t know where it exists (This has to be developed under
> >JDK 1.4.2). Thanks guys.
>
> See http://mindprod.com/jgloss/base64.html

There is a public domain implementation available, and it works like a
charm at http://iharder.sourceforge.net/current/java/base64/

Signature

Sabine Dinis Blochberger

Op3racional
www.op3racional.eu

Lew - 21 Dec 2007 15:59 GMT
>>> Can anyone tell me what jar or package I need to include sun.misc.Base64.*
>>> dependencies? I want to use this package in an application being developed
[quoted text clipped - 4 lines]
> There is a public domain implementation available, and it works like a
> charm at http://iharder.sourceforge.net/current/java/base64/

Only one?

Marcelo Morales mentioned another one upthread,
<http://commons.apache.org/codec/>.  Sourceforge even has another,
<http://migbase64.sourceforge.net/>

Signature

Lew

Roedy Green - 21 Dec 2007 19:48 GMT
>Marcelo Morales mentioned another one upthread,
><http://commons.apache.org/codec/>.  Sourceforge even has another,
><http://migbase64.sourceforge.net/>

there are quite a few links at http://mindprod.com/jgloss/base64.html

It might be a suitable job for a newbie to try them all out,make some
notes on how each was to use, and post some benchmarks.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Arne Vajhøj - 21 Dec 2007 23:29 GMT
>> Marcelo Morales mentioned another one upthread,
>> <http://commons.apache.org/codec/>.  Sourceforge even has another,
[quoted text clipped - 4 lines]
> It might be a suitable job for a newbie to try them all out,make some
> notes on how each was to use, and post some benchmarks.

Neither should be recommended when a solution exist within
javax classes.

Arne
Lew - 22 Dec 2007 01:23 GMT
Roedy Green wrote:
>> there are quite a few links at http://mindprod.com/jgloss/base64.html
>>
>> It might be a suitable job for a newbie to try them all out,make some
>> notes on how each was to use, and post some benchmarks.

> Neither should be recommended when a solution exist within
> javax classes.

As you mentioned earlier.

<http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeUtility.html>
<http://java.sun.com/javaee/5/docs/api/javax/mail/internet/MimeUtility.html#encod
e(java.io.OutputStream,%20java.lang.String
)>

&c.

Signature

Lew

Roedy Green - 22 Dec 2007 20:00 GMT
>Neither should be recommended when a solution exist within
>javax classes.

Is Javamail now bundled?  It would be a pretty big jar to include in a
distribution just to get one class.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Martin Gregorie - 23 Dec 2007 01:17 GMT
>> Neither should be recommended when a solution exist within
>> javax classes.
>
> Is Javamail now bundled?  It would be a pretty big jar to include in a
> distribution just to get one class.

It wasn't last time I looked.

Signature

martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Arne Vajhøj - 23 Dec 2007 02:22 GMT
>> Neither should be recommended when a solution exist within
>> javax classes.
>
> Is Javamail now bundled?

No.

>                           It would be a pretty big jar to include in a
> distribution just to get one class.

Only 300 KB.

Arne
Roedy Green - 23 Dec 2007 09:21 GMT
>Only 300 KB.
that is not much for a application, but is excessive for an Applet.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Arne Vajhøj - 23 Dec 2007 17:28 GMT
>> Only 300 KB.
> that is not much for a application, but is excessive for an Applet.

If it is dialup.

Arne
Arne Vajhøj - 21 Dec 2007 01:23 GMT
> Can anyone tell me what jar or package I need to include sun.misc.Base64.*
> dependencies? I want to use this package in an application being developed
> in Eclipse, but I don;t know where it exists (This has to be developed under
> JDK 1.4.2). Thanks guys.

Using internal Java classes from SUN is not recommended.

Use the supported Base64 in JavaMail.

    public static String b64encode(byte[] b) throws MessagingException,
IOException  {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OutputStream b64os = MimeUtility.encode(baos, "base64");
        b64os.write(b);
        b64os.close();
        return new String(baos.toByteArray());
     }
     public static byte[] b64decode(String s) throws
MessagingException, IOException  {
        ByteArrayInputStream bais = new ByteArrayInputStream(s.getBytes());
        InputStream b64is = MimeUtility.decode(bais, "Base64");
        byte[] tmp = new byte[s.length()];
        int n = b64is.read(tmp);
        byte[] res = new byte[n];
        System.arraycopy(tmp, 0, res, 0, n);
        return res;
     }

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.