commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tobr...@apache.org
Subject cvs commit: jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language TestDoubleMetaphone.java TestMetaphone.java TestNysiis.java TestRefinedSoundex.java TestSoundex.java
Date Sun, 16 Feb 2003 19:04:04 GMT
tobrien     2003/02/16 11:04:04

  Modified:    codec    PROPOSAL.html
               codec/src/java/org/apache/commons/codec Encoder.java
               codec/src/java/org/apache/commons/codec/binary Base64.java
               codec/src/java/org/apache/commons/codec/language
                        DoubleMetaphone.java Metaphone.java Nysiis.java
                        RefinedSoundex.java Soundex.java
               codec/src/test/org/apache/commons/codec/binary
                        TestBase64.java
               codec/src/test/org/apache/commons/codec/language
                        TestDoubleMetaphone.java TestMetaphone.java
                        TestNysiis.java TestRefinedSoundex.java
                        TestSoundex.java
  Added:       codec/src/java/org/apache/commons/codec BinaryEncoder.java
                        Decoder.java DecoderException.java
                        EncoderException.java StringEncoder.java
               codec/src/test/org/apache/commons/codec
                        TestBinaryEncoder.java TestStringEncoder.java
  Log:
  General refactoring and refining Encoder interfaces
  
  Revision  Changes    Path
  1.4       +1 -0      jakarta-commons-sandbox/codec/PROPOSAL.html
  
  Index: PROPOSAL.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/PROPOSAL.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PROPOSAL.html	7 Mar 2002 22:34:20 -0000	1.3
  +++ PROPOSAL.html	16 Feb 2003 19:04:03 -0000	1.4
  @@ -67,6 +67,7 @@
   <li>Scott Sanders (sanders)</li>
   <li>Henri Yandell (bayard)</li>
   <li>Daniel Rall (dlr)</li>
  +<li>Tim O'Brien (tobrien)</li>
   <!-- Add your real name and user name here -->
   </ul>
   </p>
  
  
  
  1.5       +2 -2      jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Encoder.java
  
  Index: Encoder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Encoder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Encoder.java	3 Feb 2003 16:03:54 -0000	1.4
  +++ Encoder.java	16 Feb 2003 19:04:03 -0000	1.5
  @@ -61,6 +61,6 @@
    * @version $Revision$ $Date$
    */
   public interface Encoder {
  -    String encode(String str);
  +    Object encode(Object pObject) throws EncoderException;
   }  
   
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/BinaryEncoder.java
  
  Index: BinaryEncoder.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Commons" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Commons", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.codec;
  
  /**
   * @author tobrien@transolutions.net
   * @version $Revision: 1.1 $ $Date: 2003/02/16 19:04:03 $
   */
  public interface BinaryEncoder extends Encoder {
      byte[] encode(byte[] pArray) throws EncoderException;
  }  
  
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Decoder.java
  
  Index: Decoder.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Commons" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Commons", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.codec;
  
  /**
   * @author tobrien@transolutions.net
   * @version $Revision: 1.1 $ $Date: 2003/02/16 19:04:03 $
   */
  public interface Decoder {
      Object decode(Object pObject) throws DecoderException;
  }  
  
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/DecoderException.java
  
  Index: DecoderException.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Commons" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Commons", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.codec;
  
  /**
   * @author tobrien@transolutions.net
   * @version $Revision: 1.1 $ $Date: 2003/02/16 19:04:03 $
   */
  public class DecoderException extends Exception {
  
      public DecoderException(String pMessage) {
  	super( pMessage );
      }
  
  }  
  
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/EncoderException.java
  
  Index: EncoderException.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Commons" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Commons", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.codec;
  
  /**
   * @author tobrien@transolutions.net
   * @version $Revision: 1.1 $ $Date: 2003/02/16 19:04:03 $
   */
  public class EncoderException extends Exception {
  
      public EncoderException(String pMessage) {
  	super( pMessage );
      }
  
  }  
  
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/StringEncoder.java
  
  Index: StringEncoder.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Commons" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Commons", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.codec;
  
  /**
   * Encoder is an interface, which is implemented by Soundex,
   * Metaphone, Soundex2, etc.
   *
   * @author tobrien@transolutions.net
   * @version $Revision: 1.1 $ $Date: 2003/02/16 19:04:03 $
   */
  public interface StringEncoder extends Encoder {
      String encode(String pString) throws EncoderException;
  }  
  
  
  
  
  1.3       +66 -10    jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/binary/Base64.java
  
  Index: Base64.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/binary/Base64.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Base64.java	7 Feb 2003 00:06:49 -0000	1.2
  +++ Base64.java	16 Feb 2003 19:04:03 -0000	1.3
  @@ -66,6 +66,11 @@
   import java.util.Enumeration;
   import java.util.Vector;
   
  +import org.apache.commons.codec.BinaryDecoder;
  +import org.apache.commons.codec.BinaryEncoder;
  +import org.apache.commons.codec.DecoderException;
  +import org.apache.commons.codec.EncoderException;
  +
   /**
     * This class provides encode/decode for RFC 2045 Base64 as defined by
     * RFC 2045, N. Freed and N. Borenstein.  <a
  @@ -78,7 +83,7 @@
     * @author <a href="m.redington@ucl.ac.uk">Martin Redington</a>
     * @since 1.2
     */
  -public final class Base64
  +public class Base64 implements BinaryEncoder, BinaryDecoder
   {
        static final int CHUNK_SIZE = 76;
        static final byte[] CHUNK_SEPARATOR = "\n".getBytes();
  @@ -161,12 +166,63 @@
            return true;
        }
   
  -    public static byte[] encode( byte[] binaryData ) {
  -	return( encode( binaryData, false ) );
  +    public Object encode(Object pObject) throws EncoderException {
  +
  +	Object result;
  +
  +	if( !(pObject instanceof byte[]) ) {
  +	    throw new EncoderException( "Parameter supplied to " +
  +					"Base64 " +
  +				   "encode is not a byte[]" ); 
  +	} else {
  +	    result = encode( (byte[]) pObject );
  +	}
  +
  +	return result;
  +
  +    }
  +
  +    public byte[] encode(byte[] pArray) throws EncoderException {
  +	return( base64( pArray, false ) );
  +    }
  +
  +    public static byte[] base64( byte[] binaryData ) {
  +	return( base64( binaryData, false ) );
       }
   
  -    public static byte[] encodeChunked( byte[] binaryData ) {
  -	return( encode( binaryData, true ) );
  +    public static byte[] base64Chunked( byte[] binaryData ) {
  +	return( base64( binaryData, true ) );
  +    }
  +
  +    public Object decode(Object pObject) throws DecoderException {
  +
  +	Object result;
  +
  +	if( !(pObject instanceof byte[]) ) {
  +	    throw new DecoderException( "Parameter supplied to " +
  +					"Base64 " +
  +				   "decode is not a byte[]" ); 
  +	} else {
  +	    result = decode( (byte[]) pObject );
  +	}
  +
  +	return result;
  +
  +    }
  +
  +    public byte[] decode(byte[] pArray) throws DecoderException {
  +	
  +	byte[] result;
  +
  +	if( !isArrayByteBase64(pArray) ) {
  +	    throw new DecoderException( "Parameter supplied to " +
  +					"Base64 " +
  +				   "decode is not a valid base64 data." ); 
  +	} else {
  +	    result = base64decode( (byte[]) pArray );
  +	}
  +
  +	return( result );
       }
   
        /**
  @@ -175,7 +231,7 @@
         * @param binaryData Array containing binary data to encode.
         * @return Base64-encoded data.
         */
  -     public static byte[] encode( byte[] binaryData, boolean isChunked )
  +     public static byte[] base64( byte[] binaryData, boolean isChunked )
        {
            int      lengthDataBits    = binaryData.length*EIGHTBIT;
            int      fewerThan24bits   = lengthDataBits%TWENTYFOURBITGROUP;
  @@ -309,7 +365,7 @@
         * @param binaryData Byte array containing Base64 data
         * @return Array containing decoded data.
         */
  -     public static byte[] decode( byte[] base64Data )
  +     public static byte[] base64decode( byte[] base64Data )
        {
            // RFC 2045 suggests line wrapping at (no more than) 76
            // characters -- we may have embedded whitespace.
  
  
  
  1.5       +22 -5     jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/DoubleMetaphone.java
  
  Index: DoubleMetaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/DoubleMetaphone.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DoubleMetaphone.java	8 Feb 2003 22:53:05 -0000	1.4
  +++ DoubleMetaphone.java	16 Feb 2003 19:04:04 -0000	1.5
  @@ -53,7 +53,8 @@
    */
   package org.apache.commons.codec.language;
   
  -import org.apache.commons.codec.Encoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.EncoderException;
   
   /**
    * A class to generate phonetic codings based on the double metaphone
  @@ -68,7 +69,7 @@
    * @author Ed Parish
    * @author <a href="mortis@voicenet.com">Kyle R. Burton</a> 
    */
  -public class DoubleMetaphone implements Encoder {
  +public class DoubleMetaphone implements StringEncoder {
   
     /** The current character position in the string being encoded. */
     private int current;
  @@ -340,7 +341,7 @@
      * @param in the string to encode
      * @return the encoded string
      */ 
  -  public static String sencode( String in ) {
  +  public static String sencode( String in ) throws EncoderException {
       DoubleMetaphone dm = new DoubleMetaphone();
       return dm.encode(in);
     }
  @@ -353,10 +354,26 @@
      * @param in the input string to encode
      * @return the primary encoding.
      */
  -  public String encode( String in ) {
  +  public String encode( String in ) throws EncoderException {
       setInput(in);
       return encode();
     }
  +
  +    public Object encode(Object pObject) throws EncoderException {
  +	Object result;
  +
  +	if( !(pObject instanceof java.lang.String) ) {
  +	    throw new EncoderException( "Parameter supplied to " +
  +					"DoubleMetaphone " +
  +				   "encode is not of type java.lang.String" ); 
  +	} else {
  +	    setInput( (String) pObject );
  +	    result = encode();
  +	}
  +
  +	return result;
  +    }
  +
   
     /**
      * Encode the already set input string using the Double Metaphone algorithm.
  
  
  
  1.2       +18 -4     jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/Metaphone.java
  
  Index: Metaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/Metaphone.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Metaphone.java	4 Feb 2003 04:43:58 -0000	1.1
  +++ Metaphone.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -53,7 +53,8 @@
    */
   package org.apache.commons.codec.language;
   
  -import org.apache.commons.codec.Encoder;
  +import org.apache.commons.codec.EncoderException;
  +import org.apache.commons.codec.StringEncoder;
   
   /**
    * A class to generate phonetic code.
  @@ -68,7 +69,7 @@
    * @author bayard@generationjava.com
    * @author tobrien@transolutions.net
    */
  -public class Metaphone implements Encoder {
  +public class Metaphone implements StringEncoder {
   
       private String vowels = "AEIOU" ;
       private String frontv = "EIY"   ;
  @@ -278,7 +279,20 @@
         return code.toString();
       } // end static method metaPhone()
       
  -    public String encode(String pString) {
  +    public Object encode(Object pObject) throws EncoderException {
  +	Object result;
  +
  +	if( !(pObject instanceof java.lang.String) ) {
  +	    throw new EncoderException( "Parameter supplied to Metaphone " +
  +				   "encode is not of type java.lang.String" ); 
  +	} else {
  +	    result = metaphone( (String) pObject );
  +	}
  +
  +	return result;
  +    }
  +
  +    public String encode(String pString) throws EncoderException {
           return( metaphone( pString ) );   
       }
   
  
  
  
  1.4       +30 -7     jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/Nysiis.java
  
  Index: Nysiis.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/Nysiis.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Nysiis.java	4 Feb 2003 04:43:58 -0000	1.3
  +++ Nysiis.java	16 Feb 2003 19:04:04 -0000	1.4
  @@ -53,7 +53,8 @@
    */
   package org.apache.commons.codec.language;
   
  -import org.apache.commons.codec.Encoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.EncoderException;
   
   /**
    * A class to generate phonetic codings based on the New York State
  @@ -68,7 +69,7 @@
    * @version $Revision$
    * @author <a href="mortis@voicenet.com">Kyle R. Burton</a>
    */
  -public final class Nysiis implements Encoder {
  +public final class Nysiis implements StringEncoder {
   
     /** Enable/disable internal debugging. */
     private boolean debug = false;
  @@ -82,17 +83,39 @@
      * @param word the data to encode.
      * @return the encoded string.
      */
  -  public static String sencode( String word ) {
  +  public static String sencode( String word ) throws EncoderException {
       Nysiis ny = new Nysiis();
       return ny.encode(word);
     }
   
  +    public String encode(String pString) throws EncoderException {
  +
  +	return( nysiis( pString ) );
  +
  +    }
  +
  +    public Object encode(Object pObject) throws EncoderException {
  +
  +	Object result;
  +
  +	if( !(pObject instanceof java.lang.String) ) {
  +	    throw new EncoderException( "Parameter supplied to " +
  +					"Nysiis " +
  +				   "encode is not of type java.lang.String" ); 
  +	} else {
  +	    result = nysiis( (String) pObject );
  +	}
  +
  +	return result;
  +
  +    }
  +
     /**
      * Encode the given string using the Nysiis phonetic encoding algorithm.
      * @param  String originalWord
      * @return String - the encoded word
      */
  -  public String encode( String originalWord ) {
  +  public String nysiis( String originalWord ) {
   
         if( originalWord != null &&
   	  originalWord.length() > 0 ) {
  @@ -322,14 +345,14 @@
       System.out.flush();
     }
   
  -  /**
  +    /*
      * Check if the two strings encode to the same primary or alternate encodings
      * using the Nysiis algorithm.
      * @param s1
      * @param s2
      * @return true/false
      */
  -  public static boolean isEncodeEqual( String s1, String s2 ) {
  +  public static boolean isEncodeEqual( String s1, String s2 ) throws EncoderException {
       return sencode( s1 ).equals( sencode( s2 ) );
     }
   }
  
  
  
  1.2       +22 -4     jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/RefinedSoundex.java
  
  Index: RefinedSoundex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/RefinedSoundex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RefinedSoundex.java	4 Feb 2003 04:43:59 -0000	1.1
  +++ RefinedSoundex.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -53,7 +53,8 @@
    */
   package org.apache.commons.codec.language;
   
  -import org.apache.commons.codec.Encoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.EncoderException;
   
   /**
    * Encodes a string into a soundex value.  Sounde is an encoding used to
  @@ -64,7 +65,7 @@
    * @author tobrien@transolutions.net
    * @version $Revision$ $Date$
    */
  -public class RefinedSoundex implements Encoder {
  +public class RefinedSoundex implements StringEncoder {
   
       static public final char[] US_ENGLISH_MAPPING =
           "01360240043788015936020505".toCharArray();
  @@ -113,9 +114,26 @@
           return sBuf.toString();
       }
   
  -    public String encode(String pString) {
  +    public String encode(String pString) throws EncoderException {
           return( soundex( pString ) );   
       }
  +
  +    public Object encode(Object pObject) throws EncoderException {
  +
  +	Object result;
  +
  +	if( !(pObject instanceof java.lang.String) ) {
  +	    throw new EncoderException( "Parameter supplied to " +
  +					"RefinedSoundex " +
  +				   "encode is not of type java.lang.String" ); 
  +	} else {
  +	    result = soundex( (String) pObject );
  +	}
  +
  +	return result;
  +
  +    }
  +
   
       /**
        * Used internally by the SoundEx algorithm.
  
  
  
  1.2       +22 -4     jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/Soundex.java
  
  Index: Soundex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/language/Soundex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Soundex.java	4 Feb 2003 04:43:59 -0000	1.1
  +++ Soundex.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -53,7 +53,8 @@
    */
   package org.apache.commons.codec.language;
   
  -import org.apache.commons.codec.Encoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.EncoderException;
   
   /**
    * Encodes a string into a refined soundex value.  
  @@ -67,7 +68,7 @@
    * @author tobrien@transolutions.net
    * @version $Revision$ $Date$
    */
  -public class Soundex implements Encoder {
  +public class Soundex implements StringEncoder {
   
       static public final char[] US_ENGLISH_MAPPING =
           "01230120022455012623010202".toCharArray();
  @@ -111,7 +112,24 @@
           return new String(out);
       }
   
  -    public String encode(String pString) {
  +    public Object encode(Object pObject) throws EncoderException {
  +
  +	Object result;
  +
  +	if( !(pObject instanceof java.lang.String) ) {
  +	    throw new EncoderException( "Parameter supplied to " +
  +					"Soundex " +
  +				   "encode is not of type java.lang.String" ); 
  +	} else {
  +	    result = soundex( (String) pObject );
  +	}
  +
  +	return result;
  +
  +    }
  +
  +
  +    public String encode(String pString) throws EncoderException {
           return( soundex( pString ) );   
       }
   
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestBinaryEncoder.java
  
  Index: TestBinaryEncoder.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestBinaryEncoder.java,v 1.1 2003/02/16 19:04:04 tobrien Exp $
   * $Revision: 1.1 $
   * $Date: 2003/02/16 19:04:04 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.codec;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/16 19:04:04 $
   * @author Rodney Waldhoff
   * @author <a href="tobrien@apache.org">Tim O'Brien</a>
   */
  public abstract class TestBinaryEncoder extends TestCase {
  
      public TestBinaryEncoder(String name) {
          super(name);
      }
  
      protected abstract BinaryEncoder makeEncoder();
  
      // ------------------------------------------------------------------------
  
      public void testEncodeEmpty() throws Exception {
          BinaryEncoder encoder = makeEncoder();
          encoder.encode(new byte[0]);
      }        
  
      public void testEncodeNull() throws Exception {
          BinaryEncoder encoder = makeEncoder();
  	try {
  	    encoder.encode(null);
  	} catch( EncoderException ee ) {
  	    // An exception should be thrown
  	}
      }        
  }
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestStringEncoder.java
  
  Index: TestStringEncoder.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestStringEncoder.java,v 1.1 2003/02/16 19:04:04 tobrien Exp $
   * $Revision: 1.1 $
   * $Date: 2003/02/16 19:04:04 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.codec;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/16 19:04:04 $
   * @author Rodney Waldhoff
   * @author <a href="mailto:tobrien@apache.org">Tim O'Brien</a>
   */
  public abstract class TestStringEncoder extends TestCase {
  
      public TestStringEncoder(String name) {
          super(name);
      }
  
      protected abstract StringEncoder makeEncoder();
  
      // ------------------------------------------------------------------------
  
      public void testEncodeEmpty() throws Exception {
          Encoder encoder = makeEncoder();
          encoder.encode("");
          encoder.encode(" ");
          encoder.encode("\t");
      }        
  
      public void testEncodeNull() throws Exception {
          StringEncoder encoder = makeEncoder();
  	
  	try {
  	    encoder.encode(null);
  	} catch( EncoderException ee ) {
  	    // An exception should be thrown
  	}
      }        
  }
  
  
  
  1.3       +191 -191  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/binary/TestBase64.java
  
  Index: TestBase64.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/binary/TestBase64.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestBase64.java	7 Feb 2003 00:07:31 -0000	1.2
  +++ TestBase64.java	16 Feb 2003 19:04:04 -0000	1.3
  @@ -111,7 +111,7 @@
       public void testBase64() {
           String content = "Hello World";
           String encodedContent;
  -        encodedContent = new String(Base64.encode(content.getBytes()));
  +        encodedContent = new String(Base64.base64(content.getBytes()));
           assertTrue("encoding hello world", encodedContent.equals("SGVsbG8gV29ybGQ="));
       }
   
  @@ -120,9 +120,9 @@
           for(int i=0;i<12;i++) {
               byte[] data = new byte[i];
               _random.nextBytes(data);
  -            byte[] enc =  Base64.encode(data);
  +            byte[] enc =  Base64.base64(data);
               assertTrue("\"" + (new String(enc)) + "\" is Base64 data.",Base64.isBase64((new String(enc))));
  -            byte[] data2 = Base64.decode(enc);
  +            byte[] data2 = Base64.base64decode(enc);
               assertTrue(toString(data) + " equals " + toString(data2),Arrays.equals(data,data2));
           }
       }
  @@ -132,205 +132,205 @@
           for(int i=1;i<5;i++) {
               byte[] data = new byte[_random.nextInt(10000)+1];
               _random.nextBytes(data);
  -            byte[] enc =  Base64.encode(data);
  +            byte[] enc =  Base64.base64(data);
               assertTrue(Base64.isBase64(new String(enc)));
  -            byte[] data2 = Base64.decode(enc);
  +            byte[] data2 = Base64.base64decode(enc);
               assertTrue(Arrays.equals(data,data2));
           }
       }
   
       public void testSingletons() {
  -        assertEquals("AA==",new String(Base64.encode(new byte[] { (byte)0 })));
  -        assertEquals("AQ==",new String(Base64.encode(new byte[] { (byte)1 })));
  -        assertEquals("Ag==",new String(Base64.encode(new byte[] { (byte)2 })));
  -        assertEquals("Aw==",new String(Base64.encode(new byte[] { (byte)3 })));
  -        assertEquals("BA==",new String(Base64.encode(new byte[] { (byte)4 })));
  -        assertEquals("BQ==",new String(Base64.encode(new byte[] { (byte)5 })));
  -        assertEquals("Bg==",new String(Base64.encode(new byte[] { (byte)6 })));
  -        assertEquals("Bw==",new String(Base64.encode(new byte[] { (byte)7 })));
  -        assertEquals("CA==",new String(Base64.encode(new byte[] { (byte)8 })));
  -        assertEquals("CQ==",new String(Base64.encode(new byte[] { (byte)9 })));
  -        assertEquals("Cg==",new String(Base64.encode(new byte[] { (byte)10 })));
  -        assertEquals("Cw==",new String(Base64.encode(new byte[] { (byte)11 })));
  -        assertEquals("DA==",new String(Base64.encode(new byte[] { (byte)12 })));
  -        assertEquals("DQ==",new String(Base64.encode(new byte[] { (byte)13 })));
  -        assertEquals("Dg==",new String(Base64.encode(new byte[] { (byte)14 })));
  -        assertEquals("Dw==",new String(Base64.encode(new byte[] { (byte)15 })));
  -        assertEquals("EA==",new String(Base64.encode(new byte[] { (byte)16 })));
  -        assertEquals("EQ==",new String(Base64.encode(new byte[] { (byte)17 })));
  -        assertEquals("Eg==",new String(Base64.encode(new byte[] { (byte)18 })));
  -        assertEquals("Ew==",new String(Base64.encode(new byte[] { (byte)19 })));
  -        assertEquals("FA==",new String(Base64.encode(new byte[] { (byte)20 })));
  -        assertEquals("FQ==",new String(Base64.encode(new byte[] { (byte)21 })));
  -        assertEquals("Fg==",new String(Base64.encode(new byte[] { (byte)22 })));
  -        assertEquals("Fw==",new String(Base64.encode(new byte[] { (byte)23 })));
  -        assertEquals("GA==",new String(Base64.encode(new byte[] { (byte)24 })));
  -        assertEquals("GQ==",new String(Base64.encode(new byte[] { (byte)25 })));
  -        assertEquals("Gg==",new String(Base64.encode(new byte[] { (byte)26 })));
  -        assertEquals("Gw==",new String(Base64.encode(new byte[] { (byte)27 })));
  -        assertEquals("HA==",new String(Base64.encode(new byte[] { (byte)28 })));
  -        assertEquals("HQ==",new String(Base64.encode(new byte[] { (byte)29 })));
  -        assertEquals("Hg==",new String(Base64.encode(new byte[] { (byte)30 })));
  -        assertEquals("Hw==",new String(Base64.encode(new byte[] { (byte)31 })));
  -        assertEquals("IA==",new String(Base64.encode(new byte[] { (byte)32 })));
  -        assertEquals("IQ==",new String(Base64.encode(new byte[] { (byte)33 })));
  -        assertEquals("Ig==",new String(Base64.encode(new byte[] { (byte)34 })));
  -        assertEquals("Iw==",new String(Base64.encode(new byte[] { (byte)35 })));
  -        assertEquals("JA==",new String(Base64.encode(new byte[] { (byte)36 })));
  -        assertEquals("JQ==",new String(Base64.encode(new byte[] { (byte)37 })));
  -        assertEquals("Jg==",new String(Base64.encode(new byte[] { (byte)38 })));
  -        assertEquals("Jw==",new String(Base64.encode(new byte[] { (byte)39 })));
  -        assertEquals("KA==",new String(Base64.encode(new byte[] { (byte)40 })));
  -        assertEquals("KQ==",new String(Base64.encode(new byte[] { (byte)41 })));
  -        assertEquals("Kg==",new String(Base64.encode(new byte[] { (byte)42 })));
  -        assertEquals("Kw==",new String(Base64.encode(new byte[] { (byte)43 })));
  -        assertEquals("LA==",new String(Base64.encode(new byte[] { (byte)44 })));
  -        assertEquals("LQ==",new String(Base64.encode(new byte[] { (byte)45 })));
  -        assertEquals("Lg==",new String(Base64.encode(new byte[] { (byte)46 })));
  -        assertEquals("Lw==",new String(Base64.encode(new byte[] { (byte)47 })));
  -        assertEquals("MA==",new String(Base64.encode(new byte[] { (byte)48 })));
  -        assertEquals("MQ==",new String(Base64.encode(new byte[] { (byte)49 })));
  -        assertEquals("Mg==",new String(Base64.encode(new byte[] { (byte)50 })));
  -        assertEquals("Mw==",new String(Base64.encode(new byte[] { (byte)51 })));
  -        assertEquals("NA==",new String(Base64.encode(new byte[] { (byte)52 })));
  -        assertEquals("NQ==",new String(Base64.encode(new byte[] { (byte)53 })));
  -        assertEquals("Ng==",new String(Base64.encode(new byte[] { (byte)54 })));
  -        assertEquals("Nw==",new String(Base64.encode(new byte[] { (byte)55 })));
  -        assertEquals("OA==",new String(Base64.encode(new byte[] { (byte)56 })));
  -        assertEquals("OQ==",new String(Base64.encode(new byte[] { (byte)57 })));
  -        assertEquals("Og==",new String(Base64.encode(new byte[] { (byte)58 })));
  -        assertEquals("Ow==",new String(Base64.encode(new byte[] { (byte)59 })));
  -        assertEquals("PA==",new String(Base64.encode(new byte[] { (byte)60 })));
  -        assertEquals("PQ==",new String(Base64.encode(new byte[] { (byte)61 })));
  -        assertEquals("Pg==",new String(Base64.encode(new byte[] { (byte)62 })));
  -        assertEquals("Pw==",new String(Base64.encode(new byte[] { (byte)63 })));
  -        assertEquals("QA==",new String(Base64.encode(new byte[] { (byte)64 })));
  -        assertEquals("QQ==",new String(Base64.encode(new byte[] { (byte)65 })));
  -        assertEquals("Qg==",new String(Base64.encode(new byte[] { (byte)66 })));
  -        assertEquals("Qw==",new String(Base64.encode(new byte[] { (byte)67 })));
  -        assertEquals("RA==",new String(Base64.encode(new byte[] { (byte)68 })));
  -        assertEquals("RQ==",new String(Base64.encode(new byte[] { (byte)69 })));
  -        assertEquals("Rg==",new String(Base64.encode(new byte[] { (byte)70 })));
  -        assertEquals("Rw==",new String(Base64.encode(new byte[] { (byte)71 })));
  -        assertEquals("SA==",new String(Base64.encode(new byte[] { (byte)72 })));
  -        assertEquals("SQ==",new String(Base64.encode(new byte[] { (byte)73 })));
  -        assertEquals("Sg==",new String(Base64.encode(new byte[] { (byte)74 })));
  -        assertEquals("Sw==",new String(Base64.encode(new byte[] { (byte)75 })));
  -        assertEquals("TA==",new String(Base64.encode(new byte[] { (byte)76 })));
  -        assertEquals("TQ==",new String(Base64.encode(new byte[] { (byte)77 })));
  -        assertEquals("Tg==",new String(Base64.encode(new byte[] { (byte)78 })));
  -        assertEquals("Tw==",new String(Base64.encode(new byte[] { (byte)79 })));
  -        assertEquals("UA==",new String(Base64.encode(new byte[] { (byte)80 })));
  -        assertEquals("UQ==",new String(Base64.encode(new byte[] { (byte)81 })));
  -        assertEquals("Ug==",new String(Base64.encode(new byte[] { (byte)82 })));
  -        assertEquals("Uw==",new String(Base64.encode(new byte[] { (byte)83 })));
  -        assertEquals("VA==",new String(Base64.encode(new byte[] { (byte)84 })));
  -        assertEquals("VQ==",new String(Base64.encode(new byte[] { (byte)85 })));
  -        assertEquals("Vg==",new String(Base64.encode(new byte[] { (byte)86 })));
  -        assertEquals("Vw==",new String(Base64.encode(new byte[] { (byte)87 })));
  -        assertEquals("WA==",new String(Base64.encode(new byte[] { (byte)88 })));
  -        assertEquals("WQ==",new String(Base64.encode(new byte[] { (byte)89 })));
  -        assertEquals("Wg==",new String(Base64.encode(new byte[] { (byte)90 })));
  -        assertEquals("Ww==",new String(Base64.encode(new byte[] { (byte)91 })));
  -        assertEquals("XA==",new String(Base64.encode(new byte[] { (byte)92 })));
  -        assertEquals("XQ==",new String(Base64.encode(new byte[] { (byte)93 })));
  -        assertEquals("Xg==",new String(Base64.encode(new byte[] { (byte)94 })));
  -        assertEquals("Xw==",new String(Base64.encode(new byte[] { (byte)95 })));
  -        assertEquals("YA==",new String(Base64.encode(new byte[] { (byte)96 })));
  -        assertEquals("YQ==",new String(Base64.encode(new byte[] { (byte)97 })));
  -        assertEquals("Yg==",new String(Base64.encode(new byte[] { (byte)98 })));
  -        assertEquals("Yw==",new String(Base64.encode(new byte[] { (byte)99 })));
  -        assertEquals("ZA==",new String(Base64.encode(new byte[] { (byte)100 })));
  -        assertEquals("ZQ==",new String(Base64.encode(new byte[] { (byte)101 })));
  -        assertEquals("Zg==",new String(Base64.encode(new byte[] { (byte)102 })));
  -        assertEquals("Zw==",new String(Base64.encode(new byte[] { (byte)103 })));
  -        assertEquals("aA==",new String(Base64.encode(new byte[] { (byte)104 })));
  +        assertEquals("AA==",new String(Base64.base64(new byte[] { (byte)0 })));
  +        assertEquals("AQ==",new String(Base64.base64(new byte[] { (byte)1 })));
  +        assertEquals("Ag==",new String(Base64.base64(new byte[] { (byte)2 })));
  +        assertEquals("Aw==",new String(Base64.base64(new byte[] { (byte)3 })));
  +        assertEquals("BA==",new String(Base64.base64(new byte[] { (byte)4 })));
  +        assertEquals("BQ==",new String(Base64.base64(new byte[] { (byte)5 })));
  +        assertEquals("Bg==",new String(Base64.base64(new byte[] { (byte)6 })));
  +        assertEquals("Bw==",new String(Base64.base64(new byte[] { (byte)7 })));
  +        assertEquals("CA==",new String(Base64.base64(new byte[] { (byte)8 })));
  +        assertEquals("CQ==",new String(Base64.base64(new byte[] { (byte)9 })));
  +        assertEquals("Cg==",new String(Base64.base64(new byte[] { (byte)10 })));
  +        assertEquals("Cw==",new String(Base64.base64(new byte[] { (byte)11 })));
  +        assertEquals("DA==",new String(Base64.base64(new byte[] { (byte)12 })));
  +        assertEquals("DQ==",new String(Base64.base64(new byte[] { (byte)13 })));
  +        assertEquals("Dg==",new String(Base64.base64(new byte[] { (byte)14 })));
  +        assertEquals("Dw==",new String(Base64.base64(new byte[] { (byte)15 })));
  +        assertEquals("EA==",new String(Base64.base64(new byte[] { (byte)16 })));
  +        assertEquals("EQ==",new String(Base64.base64(new byte[] { (byte)17 })));
  +        assertEquals("Eg==",new String(Base64.base64(new byte[] { (byte)18 })));
  +        assertEquals("Ew==",new String(Base64.base64(new byte[] { (byte)19 })));
  +        assertEquals("FA==",new String(Base64.base64(new byte[] { (byte)20 })));
  +        assertEquals("FQ==",new String(Base64.base64(new byte[] { (byte)21 })));
  +        assertEquals("Fg==",new String(Base64.base64(new byte[] { (byte)22 })));
  +        assertEquals("Fw==",new String(Base64.base64(new byte[] { (byte)23 })));
  +        assertEquals("GA==",new String(Base64.base64(new byte[] { (byte)24 })));
  +        assertEquals("GQ==",new String(Base64.base64(new byte[] { (byte)25 })));
  +        assertEquals("Gg==",new String(Base64.base64(new byte[] { (byte)26 })));
  +        assertEquals("Gw==",new String(Base64.base64(new byte[] { (byte)27 })));
  +        assertEquals("HA==",new String(Base64.base64(new byte[] { (byte)28 })));
  +        assertEquals("HQ==",new String(Base64.base64(new byte[] { (byte)29 })));
  +        assertEquals("Hg==",new String(Base64.base64(new byte[] { (byte)30 })));
  +        assertEquals("Hw==",new String(Base64.base64(new byte[] { (byte)31 })));
  +        assertEquals("IA==",new String(Base64.base64(new byte[] { (byte)32 })));
  +        assertEquals("IQ==",new String(Base64.base64(new byte[] { (byte)33 })));
  +        assertEquals("Ig==",new String(Base64.base64(new byte[] { (byte)34 })));
  +        assertEquals("Iw==",new String(Base64.base64(new byte[] { (byte)35 })));
  +        assertEquals("JA==",new String(Base64.base64(new byte[] { (byte)36 })));
  +        assertEquals("JQ==",new String(Base64.base64(new byte[] { (byte)37 })));
  +        assertEquals("Jg==",new String(Base64.base64(new byte[] { (byte)38 })));
  +        assertEquals("Jw==",new String(Base64.base64(new byte[] { (byte)39 })));
  +        assertEquals("KA==",new String(Base64.base64(new byte[] { (byte)40 })));
  +        assertEquals("KQ==",new String(Base64.base64(new byte[] { (byte)41 })));
  +        assertEquals("Kg==",new String(Base64.base64(new byte[] { (byte)42 })));
  +        assertEquals("Kw==",new String(Base64.base64(new byte[] { (byte)43 })));
  +        assertEquals("LA==",new String(Base64.base64(new byte[] { (byte)44 })));
  +        assertEquals("LQ==",new String(Base64.base64(new byte[] { (byte)45 })));
  +        assertEquals("Lg==",new String(Base64.base64(new byte[] { (byte)46 })));
  +        assertEquals("Lw==",new String(Base64.base64(new byte[] { (byte)47 })));
  +        assertEquals("MA==",new String(Base64.base64(new byte[] { (byte)48 })));
  +        assertEquals("MQ==",new String(Base64.base64(new byte[] { (byte)49 })));
  +        assertEquals("Mg==",new String(Base64.base64(new byte[] { (byte)50 })));
  +        assertEquals("Mw==",new String(Base64.base64(new byte[] { (byte)51 })));
  +        assertEquals("NA==",new String(Base64.base64(new byte[] { (byte)52 })));
  +        assertEquals("NQ==",new String(Base64.base64(new byte[] { (byte)53 })));
  +        assertEquals("Ng==",new String(Base64.base64(new byte[] { (byte)54 })));
  +        assertEquals("Nw==",new String(Base64.base64(new byte[] { (byte)55 })));
  +        assertEquals("OA==",new String(Base64.base64(new byte[] { (byte)56 })));
  +        assertEquals("OQ==",new String(Base64.base64(new byte[] { (byte)57 })));
  +        assertEquals("Og==",new String(Base64.base64(new byte[] { (byte)58 })));
  +        assertEquals("Ow==",new String(Base64.base64(new byte[] { (byte)59 })));
  +        assertEquals("PA==",new String(Base64.base64(new byte[] { (byte)60 })));
  +        assertEquals("PQ==",new String(Base64.base64(new byte[] { (byte)61 })));
  +        assertEquals("Pg==",new String(Base64.base64(new byte[] { (byte)62 })));
  +        assertEquals("Pw==",new String(Base64.base64(new byte[] { (byte)63 })));
  +        assertEquals("QA==",new String(Base64.base64(new byte[] { (byte)64 })));
  +        assertEquals("QQ==",new String(Base64.base64(new byte[] { (byte)65 })));
  +        assertEquals("Qg==",new String(Base64.base64(new byte[] { (byte)66 })));
  +        assertEquals("Qw==",new String(Base64.base64(new byte[] { (byte)67 })));
  +        assertEquals("RA==",new String(Base64.base64(new byte[] { (byte)68 })));
  +        assertEquals("RQ==",new String(Base64.base64(new byte[] { (byte)69 })));
  +        assertEquals("Rg==",new String(Base64.base64(new byte[] { (byte)70 })));
  +        assertEquals("Rw==",new String(Base64.base64(new byte[] { (byte)71 })));
  +        assertEquals("SA==",new String(Base64.base64(new byte[] { (byte)72 })));
  +        assertEquals("SQ==",new String(Base64.base64(new byte[] { (byte)73 })));
  +        assertEquals("Sg==",new String(Base64.base64(new byte[] { (byte)74 })));
  +        assertEquals("Sw==",new String(Base64.base64(new byte[] { (byte)75 })));
  +        assertEquals("TA==",new String(Base64.base64(new byte[] { (byte)76 })));
  +        assertEquals("TQ==",new String(Base64.base64(new byte[] { (byte)77 })));
  +        assertEquals("Tg==",new String(Base64.base64(new byte[] { (byte)78 })));
  +        assertEquals("Tw==",new String(Base64.base64(new byte[] { (byte)79 })));
  +        assertEquals("UA==",new String(Base64.base64(new byte[] { (byte)80 })));
  +        assertEquals("UQ==",new String(Base64.base64(new byte[] { (byte)81 })));
  +        assertEquals("Ug==",new String(Base64.base64(new byte[] { (byte)82 })));
  +        assertEquals("Uw==",new String(Base64.base64(new byte[] { (byte)83 })));
  +        assertEquals("VA==",new String(Base64.base64(new byte[] { (byte)84 })));
  +        assertEquals("VQ==",new String(Base64.base64(new byte[] { (byte)85 })));
  +        assertEquals("Vg==",new String(Base64.base64(new byte[] { (byte)86 })));
  +        assertEquals("Vw==",new String(Base64.base64(new byte[] { (byte)87 })));
  +        assertEquals("WA==",new String(Base64.base64(new byte[] { (byte)88 })));
  +        assertEquals("WQ==",new String(Base64.base64(new byte[] { (byte)89 })));
  +        assertEquals("Wg==",new String(Base64.base64(new byte[] { (byte)90 })));
  +        assertEquals("Ww==",new String(Base64.base64(new byte[] { (byte)91 })));
  +        assertEquals("XA==",new String(Base64.base64(new byte[] { (byte)92 })));
  +        assertEquals("XQ==",new String(Base64.base64(new byte[] { (byte)93 })));
  +        assertEquals("Xg==",new String(Base64.base64(new byte[] { (byte)94 })));
  +        assertEquals("Xw==",new String(Base64.base64(new byte[] { (byte)95 })));
  +        assertEquals("YA==",new String(Base64.base64(new byte[] { (byte)96 })));
  +        assertEquals("YQ==",new String(Base64.base64(new byte[] { (byte)97 })));
  +        assertEquals("Yg==",new String(Base64.base64(new byte[] { (byte)98 })));
  +        assertEquals("Yw==",new String(Base64.base64(new byte[] { (byte)99 })));
  +        assertEquals("ZA==",new String(Base64.base64(new byte[] { (byte)100 })));
  +        assertEquals("ZQ==",new String(Base64.base64(new byte[] { (byte)101 })));
  +        assertEquals("Zg==",new String(Base64.base64(new byte[] { (byte)102 })));
  +        assertEquals("Zw==",new String(Base64.base64(new byte[] { (byte)103 })));
  +        assertEquals("aA==",new String(Base64.base64(new byte[] { (byte)104 })));
       }
   
       public void testTriplets() {
  -        assertEquals("AAAA",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)0 })));
  -        assertEquals("AAAB",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)1 })));
  -        assertEquals("AAAC",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)2 })));
  -        assertEquals("AAAD",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)3 })));
  -        assertEquals("AAAE",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)4 })));
  -        assertEquals("AAAF",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)5 })));
  -        assertEquals("AAAG",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)6 })));
  -        assertEquals("AAAH",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)7 })));
  -        assertEquals("AAAI",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)8 })));
  -        assertEquals("AAAJ",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)9 })));
  -        assertEquals("AAAK",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)10 })));
  -        assertEquals("AAAL",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)11 })));
  -        assertEquals("AAAM",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)12 })));
  -        assertEquals("AAAN",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)13 })));
  -        assertEquals("AAAO",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)14 })));
  -        assertEquals("AAAP",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)15 })));
  -        assertEquals("AAAQ",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)16 })));
  -        assertEquals("AAAR",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)17 })));
  -        assertEquals("AAAS",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)18 })));
  -        assertEquals("AAAT",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)19 })));
  -        assertEquals("AAAU",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)20 })));
  -        assertEquals("AAAV",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)21 })));
  -        assertEquals("AAAW",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)22 })));
  -        assertEquals("AAAX",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)23 })));
  -        assertEquals("AAAY",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)24 })));
  -        assertEquals("AAAZ",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)25 })));
  -        assertEquals("AAAa",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)26 })));
  -        assertEquals("AAAb",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)27 })));
  -        assertEquals("AAAc",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)28 })));
  -        assertEquals("AAAd",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)29 })));
  -        assertEquals("AAAe",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)30 })));
  -        assertEquals("AAAf",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)31 })));
  -        assertEquals("AAAg",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)32 })));
  -        assertEquals("AAAh",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)33 })));
  -        assertEquals("AAAi",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)34 })));
  -        assertEquals("AAAj",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)35 })));
  -        assertEquals("AAAk",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)36 })));
  -        assertEquals("AAAl",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)37 })));
  -        assertEquals("AAAm",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)38 })));
  -        assertEquals("AAAn",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)39 })));
  -        assertEquals("AAAo",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)40 })));
  -        assertEquals("AAAp",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)41 })));
  -        assertEquals("AAAq",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)42 })));
  -        assertEquals("AAAr",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)43 })));
  -        assertEquals("AAAs",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)44 })));
  -        assertEquals("AAAt",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)45 })));
  -        assertEquals("AAAu",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)46 })));
  -        assertEquals("AAAv",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)47 })));
  -        assertEquals("AAAw",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)48 })));
  -        assertEquals("AAAx",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)49 })));
  -        assertEquals("AAAy",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)50 })));
  -        assertEquals("AAAz",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)51 })));
  -        assertEquals("AAA0",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)52 })));
  -        assertEquals("AAA1",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)53 })));
  -        assertEquals("AAA2",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)54 })));
  -        assertEquals("AAA3",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)55 })));
  -        assertEquals("AAA4",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)56 })));
  -        assertEquals("AAA5",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)57 })));
  -        assertEquals("AAA6",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)58 })));
  -        assertEquals("AAA7",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)59 })));
  -        assertEquals("AAA8",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)60 })));
  -        assertEquals("AAA9",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)61 })));
  -        assertEquals("AAA+",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)62 })));
  -        assertEquals("AAA/",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)63 })));
  +        assertEquals("AAAA",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)0 })));
  +        assertEquals("AAAB",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)1 })));
  +        assertEquals("AAAC",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)2 })));
  +        assertEquals("AAAD",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)3 })));
  +        assertEquals("AAAE",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)4 })));
  +        assertEquals("AAAF",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)5 })));
  +        assertEquals("AAAG",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)6 })));
  +        assertEquals("AAAH",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)7 })));
  +        assertEquals("AAAI",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)8 })));
  +        assertEquals("AAAJ",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)9 })));
  +        assertEquals("AAAK",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)10 })));
  +        assertEquals("AAAL",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)11 })));
  +        assertEquals("AAAM",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)12 })));
  +        assertEquals("AAAN",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)13 })));
  +        assertEquals("AAAO",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)14 })));
  +        assertEquals("AAAP",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)15 })));
  +        assertEquals("AAAQ",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)16 })));
  +        assertEquals("AAAR",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)17 })));
  +        assertEquals("AAAS",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)18 })));
  +        assertEquals("AAAT",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)19 })));
  +        assertEquals("AAAU",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)20 })));
  +        assertEquals("AAAV",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)21 })));
  +        assertEquals("AAAW",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)22 })));
  +        assertEquals("AAAX",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)23 })));
  +        assertEquals("AAAY",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)24 })));
  +        assertEquals("AAAZ",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)25 })));
  +        assertEquals("AAAa",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)26 })));
  +        assertEquals("AAAb",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)27 })));
  +        assertEquals("AAAc",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)28 })));
  +        assertEquals("AAAd",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)29 })));
  +        assertEquals("AAAe",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)30 })));
  +        assertEquals("AAAf",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)31 })));
  +        assertEquals("AAAg",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)32 })));
  +        assertEquals("AAAh",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)33 })));
  +        assertEquals("AAAi",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)34 })));
  +        assertEquals("AAAj",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)35 })));
  +        assertEquals("AAAk",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)36 })));
  +        assertEquals("AAAl",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)37 })));
  +        assertEquals("AAAm",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)38 })));
  +        assertEquals("AAAn",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)39 })));
  +        assertEquals("AAAo",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)40 })));
  +        assertEquals("AAAp",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)41 })));
  +        assertEquals("AAAq",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)42 })));
  +        assertEquals("AAAr",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)43 })));
  +        assertEquals("AAAs",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)44 })));
  +        assertEquals("AAAt",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)45 })));
  +        assertEquals("AAAu",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)46 })));
  +        assertEquals("AAAv",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)47 })));
  +        assertEquals("AAAw",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)48 })));
  +        assertEquals("AAAx",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)49 })));
  +        assertEquals("AAAy",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)50 })));
  +        assertEquals("AAAz",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)51 })));
  +        assertEquals("AAA0",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)52 })));
  +        assertEquals("AAA1",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)53 })));
  +        assertEquals("AAA2",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)54 })));
  +        assertEquals("AAA3",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)55 })));
  +        assertEquals("AAA4",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)56 })));
  +        assertEquals("AAA5",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)57 })));
  +        assertEquals("AAA6",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)58 })));
  +        assertEquals("AAA7",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)59 })));
  +        assertEquals("AAA8",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)60 })));
  +        assertEquals("AAA9",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)61 })));
  +        assertEquals("AAA+",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)62 })));
  +        assertEquals("AAA/",new String(Base64.base64(new byte[] { (byte)0, (byte)0, (byte)63 })));
       }
   
       public void testKnownEncodings() {
  -        assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==",new String(Base64.encode("The quick brown fox jumped over the lazy dogs.".getBytes())));
  -	assertEquals("YmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJs\nYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFo\nIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBi\nbGFoIGJsYWg=\n",new String(Base64.encodeChunked("blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah".getBytes())));
  -        assertEquals("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==",new String(Base64.encode("It was the best of times, it was the worst of times.".getBytes())));
  -        assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==",new String(Base64.encode("http://jakarta.apache.org/commmons".getBytes())));
  -        assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==",new String(Base64.encode("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())));
  -        assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=",new String(Base64.encode("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())));
  -        assertEquals("eHl6enkh",new String(Base64.encode("xyzzy!".getBytes())));
  +        assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==",new String(Base64.base64("The quick brown fox jumped over the lazy dogs.".getBytes())));
  +	assertEquals("YmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJs\nYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFo\nIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBi\nbGFoIGJsYWg=\n",new String(Base64.base64Chunked("blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah".getBytes())));
  +        assertEquals("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==",new String(Base64.base64("It was the best of times, it was the worst of times.".getBytes())));
  +        assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==",new String(Base64.base64("http://jakarta.apache.org/commmons".getBytes())));
  +        assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==",new String(Base64.base64("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())));
  +        assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=",new String(Base64.base64("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())));
  +        assertEquals("eHl6enkh",new String(Base64.base64("xyzzy!".getBytes())));
       }
   
       public void testKnownDecodings() {
  -        assertEquals("The quick brown fox jumped over the lazy dogs.",new String(Base64.decode("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes())));
  -        assertEquals("It was the best of times, it was the worst of times.",new String(Base64.decode("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==".getBytes())));
  -        assertEquals("http://jakarta.apache.org/commmons",new String(Base64.decode("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==".getBytes())));
  -        assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",new String(Base64.decode("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==".getBytes())));
  -        assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }",new String(Base64.decode("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=".getBytes())));
  -        assertEquals("xyzzy!",new String(Base64.decode("eHl6enkh".getBytes())));
  +        assertEquals("The quick brown fox jumped over the lazy dogs.",new String(Base64.base64decode("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes())));
  +        assertEquals("It was the best of times, it was the worst of times.",new String(Base64.base64decode("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==".getBytes())));
  +        assertEquals("http://jakarta.apache.org/commmons",new String(Base64.base64decode("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==".getBytes())));
  +        assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",new String(Base64.base64decode("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==".getBytes())));
  +        assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }",new String(Base64.base64decode("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=".getBytes())));
  +        assertEquals("xyzzy!",new String(Base64.base64decode("eHl6enkh".getBytes())));
       }
   
       // -------------------------------------------------------- Private Methods
  
  
  
  1.2       +10 -10    jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestDoubleMetaphone.java
  
  Index: TestDoubleMetaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestDoubleMetaphone.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestDoubleMetaphone.java	3 Feb 2003 15:00:12 -0000	1.1
  +++ TestDoubleMetaphone.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -60,8 +60,8 @@
    */
   package org.apache.commons.codec.language;
   
  -import org.apache.commons.codec.Encoder;
  -import org.apache.commons.codec.TestEncoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.TestStringEncoder;
   
   import junit.framework.Test;
   import junit.framework.TestCase;
  @@ -71,7 +71,7 @@
    * @version $Revision$ $Date$
    * @author <a href="mortic@voicenet.com">Kyle R. Burton</a>
    */
  -public class TestDoubleMetaphone extends TestEncoder {
  +public class TestDoubleMetaphone extends TestStringEncoder {
   
     public TestDoubleMetaphone(String name) {
       super(name);
  @@ -91,13 +91,13 @@
       _encoder = null;
     }
   
  -  protected Encoder makeEncoder() {
  +  protected StringEncoder makeEncoder() {
       return new DoubleMetaphone();
     }
     
     // ------------------------------------------------------------------------
   
  -  public void testDoubleMetaphone() {
  +  public void testDoubleMetaphone() throws Exception {
       for(int i = 0; i < words.length; ++i) {
         assertEquals(
           "encoding: " + words[i],
  @@ -107,7 +107,7 @@
       }
     }
   
  -  public void testIsDoubleMetaphoneEqual() {
  +  public void testIsDoubleMetaphoneEqual() throws Exception {
       // need good examples of when two strings should encode to 
       // the same values...
     }
  
  
  
  1.2       +8 -8      jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestMetaphone.java
  
  Index: TestMetaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestMetaphone.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestMetaphone.java	4 Feb 2003 04:46:01 -0000	1.1
  +++ TestMetaphone.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -64,14 +64,14 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  -import org.apache.commons.codec.Encoder;
  -import org.apache.commons.codec.TestEncoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.TestStringEncoder;
   
   /**
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
    */
  -public class TestMetaphone extends TestEncoder {
  +public class TestMetaphone extends TestStringEncoder {
   
       public TestMetaphone(String name) {
           super(name);
  @@ -91,7 +91,7 @@
           _metaphone = null;
       }
   
  -    protected Encoder makeEncoder() {
  +    protected StringEncoder makeEncoder() {
           return new Metaphone();
       }
       
  
  
  
  1.2       +10 -10    jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestNysiis.java
  
  Index: TestNysiis.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestNysiis.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestNysiis.java	3 Feb 2003 15:48:14 -0000	1.1
  +++ TestNysiis.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -60,8 +60,8 @@
    */
   package org.apache.commons.codec.language;
   
  -import org.apache.commons.codec.Encoder;
  -import org.apache.commons.codec.TestEncoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.TestStringEncoder;
   
   import junit.framework.Test;
   import junit.framework.TestCase;
  @@ -71,7 +71,7 @@
    * @version $Revision$ $Date$
    * @author <a href="mailto:mortis@voicenet.com">Kyle R. Burton</a>
    */
  -public class TestNysiis extends TestEncoder {
  +public class TestNysiis extends TestStringEncoder {
   
     public TestNysiis(String name) {
       super(name);
  @@ -91,13 +91,13 @@
       _encoder = null;
     }
   
  -  protected Encoder makeEncoder() {
  +  protected StringEncoder makeEncoder() {
       return new Nysiis();
     }
     
     // ------------------------------------------------------------------------
   
  -  public void testNysiis() {
  +  public void testNysiis() throws Exception {
       Nysiis nysiis = new Nysiis();
       for(int i = 0; i < words.length; ++i) {
         assertEquals(
  @@ -108,7 +108,7 @@
       }
     }
   
  -  public void testIsNysiisEqual() {
  +  public void testIsNysiisEqual() throws Exception {
       // need good examples of when two strings should encode to 
       // the same values...
     }
  
  
  
  1.2       +8 -8      jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestRefinedSoundex.java
  
  Index: TestRefinedSoundex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestRefinedSoundex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestRefinedSoundex.java	4 Feb 2003 04:46:01 -0000	1.1
  +++ TestRefinedSoundex.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -64,14 +64,14 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  -import org.apache.commons.codec.Encoder;
  -import org.apache.commons.codec.TestEncoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.TestStringEncoder;
   
   /**
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
    */
  -public class TestRefinedSoundex extends TestEncoder {
  +public class TestRefinedSoundex extends TestStringEncoder {
   
       public TestRefinedSoundex(String name) {
           super(name);
  @@ -91,13 +91,13 @@
           _encoder = null;
       }
   
  -    protected Encoder makeEncoder() {
  +    protected StringEncoder makeEncoder() {
           return new RefinedSoundex();
       }
   
       // ------------------------------------------------------------------------
   
  -    public void testEncode() {
  +    public void testEncode() throws Exception {
           assertEquals("T6036084",_encoder.encode("testing"));
           assertEquals("T60",_encoder.encode("The"));
           assertEquals("Q503",_encoder.encode("quick"));
  
  
  
  1.2       +8 -8      jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestSoundex.java
  
  Index: TestSoundex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestSoundex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSoundex.java	4 Feb 2003 04:46:01 -0000	1.1
  +++ TestSoundex.java	16 Feb 2003 19:04:04 -0000	1.2
  @@ -64,14 +64,14 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  -import org.apache.commons.codec.Encoder;
  -import org.apache.commons.codec.TestEncoder;
  +import org.apache.commons.codec.StringEncoder;
  +import org.apache.commons.codec.TestStringEncoder;
   
   /**
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff
    */
  -public class TestSoundex extends TestEncoder {
  +public class TestSoundex extends TestStringEncoder {
   
       public TestSoundex(String name) {
           super(name);
  @@ -91,13 +91,13 @@
           _encoder = null;
       }
   
  -    protected Encoder makeEncoder() {
  +    protected StringEncoder makeEncoder() {
           return new Soundex();
       }
   
       // ------------------------------------------------------------------------
   
  -    public void testEncode() {
  +    public void testEncode() throws Exception {
           assertEquals("T235",_encoder.encode("testing"));
           assertEquals("T000",_encoder.encode("The"));
           assertEquals("Q200",_encoder.encode("quick"));
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message