Bonjour Gillard
Very good your example ..about UU UE and BASE64 de-coders
But where I can get the package sun.misc.* ???
It is not present in JDK 1.2.1
Claude HONNORE ( [EMAIL PROTECTED] )
> And here's a short sample from an undocumented java presentation I did at
> Colorado Software Summit a few years ago on encoding and decoding.
>
> ------------------------------------
>
> import sun.misc.*;
> import java.io.*;
>
> /** A class to test the encoders and decoders using a hard coded string
> Tested encoders and decoders are:
> - BASE64, UC, UU
> HexDumpEncoder doesn't have a corresponding decoder
> */
> public class EnDecodeTest {
> public static void main(String[] args) throws IOException {
>
> // text to encode and decode
> String originalText = "Hi There, please encode and decode me";
> // turn the string into a byte array
> byte[] originalBytes = originalText.getBytes();
>
> // create all the encoders and decoders for later use
> BASE64Encoder b64E = new BASE64Encoder();
> BASE64Decoder b64D = new BASE64Decoder();
> UCEncoder ucE = new UCEncoder();
> UCDecoder ucD = new UCDecoder();
> UUEncoder uuE = new UUEncoder();
> UUDecoder uuD = new UUDecoder();
> HexDumpEncoder hxE = new HexDumpEncoder();
>
> System.out.println("Orignl *" + originalText + "*");
>
>
System.out.println("========================================================
");
>
> // do base 64 stuff
> System.out.println();
> String b64Enc = b64E.encodeBuffer(originalBytes);
> System.out.println("Base64 *" + b64Enc + "*");
>
> String b64Dec = new String(b64D.decodeBuffer(b64Enc));
> System.out.println("Decode *" + b64Dec + "*");
>
> // do UC stuff
> System.out.println();
> String ucEnc = ucE.encodeBuffer(originalBytes);
> System.out.println("UCEnc *" + ucEnc + "*");
>
> String ucDec = new String(ucD.decodeBuffer(ucEnc));
> System.out.println("Decode *" + ucDec + "*");
>
> // do UU stuff
> System.out.println();
> String uuEnc = uuE.encodeBuffer(originalBytes);
> System.out.println("UUEnc *" + uuEnc + "*");
>
> // this failed under jdk1.1.1 to 1.1.4 - uncomment if you want to
test
> // String uuDec = new String(uuD.decodeBuffer(uuEnc));
> // System.out.println("Decode *" + uuDec + "*");
>
> // do HexDump stuff
> System.out.println();
> String hxEnc = hxE.encodeBuffer(originalBytes);
> System.out.println("HexEnc *" + hxEnc + "*");
>
> }
> }
> --
> dIon Gillard, Multitask Consulting
> Work: http://www.multitask.com.au
> Play: http://www.trongus.com
>
>
> >I have just skimmed this, so I apologize if it is answered in the
article,
> >but when you enter the username and password in the generic pop-up box,
is
> >it sent encrypted in some way?
>
>
> Yes it's ecoded with the Base64 method You have the decoder class in
> sun.misc.Base64Decoder
> Best wishes ,
> Andras
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html