----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

oops. You also need to to insert the decoding methods:

     public static byte [ ]  decode ( String  charString )
     {
       return decode ( charString.toCharArray ( ) );
     }

     public static byte [ ]  decode ( char [ ]  charArray )
     {
       if ( charArray.length == 0 ) return new byte [ 0 ];

       int  charLength = charArray.length;

       while ( charArray [ charLength - 1 ] == '=' ) charLength--;

       int  byteLength = 6 * charLength / 8;

       byte [ ]  byteArray = new byte [ byteLength ];

       int  byteIndex = 0;

       int  charIndex = 0;

       while ( charIndex < charLength )
       {
         int  bits24 = 0;

         for ( int  i = 0; i < 4; i++ )
         {
           int  bits6 = -1;
           for ( int  k = 0; k < alphabet.length; k++ )
           {
             if ( charArray [ charIndex ] == alphabet [ k ] )
             {
               bits6 = k;
               break;
             }
           }

           bits24 |= ( bits6 & 0xFF ) << ( 18 - 6 * i );

           charIndex++;
           if ( charIndex == charLength ) break;
         }

         byteArray [ byteIndex++ ]
             = ( byte ) ( ( bits24 & 0x00FF0000 ) >> 16 );

         if ( byteIndex < byteLength )
         {
           byteArray [ byteIndex++ ]
             = ( byte ) ( ( bits24 & 0x0000FF00 ) >>  8 );
         }

         if ( byteIndex < byteLength )
         {
           byteArray [ byteIndex++ ]
             = ( byte ) ( ( bits24 & 0x000000FF ) >>  0 );
         }
       }

       return byteArray;
     }

Corey



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to