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/binary TestBase64.java TestHex.java
Date Tue, 25 Feb 2003 08:19:41 GMT
tobrien     2003/02/25 00:19:41

  Modified:    codec    TODO
               codec/src/java/org/apache/commons/codec/binary Base64.java
                        Hex.java
               codec/src/java/org/apache/commons/codec/language
                        DoubleMetaphone.java Nysiis.java
               codec/src/test/org/apache/commons/codec/binary
                        TestBase64.java TestHex.java
  Log:
  altered method naming (mainly binary package)
  
  Revision  Changes    Path
  1.11      +4 -0      jakarta-commons-sandbox/codec/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/TODO,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TODO	25 Feb 2003 04:16:14 -0000	1.10
  +++ TODO	25 Feb 2003 08:19:40 -0000	1.11
  @@ -45,8 +45,12 @@
   
   * add more documentation to Base64
   
  +* Move towards a standard naming convention for encoders/decoders as
  +  described on 
  +
   ** DONE (this list will help us generate RELEASE-NOTES when it comes time for a release)
   
  +2/25/03 - TOB - * changes to method naming standard - see http://nagoya.apache.org/wiki/apachewiki.cgi?CodecProjectPages/CodecNaming
   2/24/03 - TOB - * Added HEx implementation from Christopher O'Brien
   2/1?/03 - TOB - * Refactor Base64 to implement both Encoder and Decoder 
   2/1?/03 - TOB - * Add a Decoder interface 
  
  
  
  1.7       +11 -11    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Base64.java	25 Feb 2003 07:51:51 -0000	1.6
  +++ Base64.java	25 Feb 2003 08:19:40 -0000	1.7
  @@ -157,12 +157,12 @@
       }
   
   
  -    public static byte[] base64(byte[] binaryData) {
  -        return (base64(binaryData, false));
  +    public static byte[] encodeBase64(byte[] binaryData) {
  +        return (encodeBase64(binaryData, false));
       }
   
  -    public static byte[] base64Chunked(byte[] binaryData) {
  -        return (base64(binaryData, true));
  +    public static byte[] encodeBase64Chunked(byte[] binaryData) {
  +        return (encodeBase64(binaryData, true));
       }
   
       public Object decode(Object pObject) throws DecoderException {
  @@ -192,7 +192,7 @@
                       + "Base64 "
                       + "decode is not a valid base64 data.");
           } else {
  -            result = base64decode((byte[]) pArray);
  +            result = decodeBase64((byte[]) pArray);
           }
   
           return (result);
  @@ -204,7 +204,7 @@
        * @param binaryData Array containing binary data to encode.
        * @return Base64-encoded data.
        */
  -    public static byte[] base64(byte[] binaryData, boolean isChunked) {
  +    public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
           int lengthDataBits = binaryData.length * EIGHTBIT;
           int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
           int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
  @@ -357,7 +357,7 @@
        * @param binaryData Byte array containing Base64 data
        * @return Array containing decoded data.
        */
  -    public static byte[] base64decode(byte[] base64Data) {
  +    public static byte[] decodeBase64(byte[] base64Data) {
           // RFC 2045 suggests line wrapping at (no more than) 76
           // characters -- we may have embedded whitespace.
           base64Data = discardWhitespace(base64Data);
  @@ -483,7 +483,7 @@
       }
   
       public byte[] encode(byte[] pArray) throws EncoderException {
  -        return (base64(pArray, false));
  +        return (encodeBase64(pArray, false));
       }
   
   }
  
  
  
  1.3       +2 -2      jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/binary/Hex.java
  
  Index: Hex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/binary/Hex.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Hex.java	25 Feb 2003 07:51:51 -0000	1.2
  +++ Hex.java	25 Feb 2003 08:19:40 -0000	1.3
  @@ -77,7 +77,7 @@
          double the length of the passed array, as it takes two characters to
          represent any given byte.
       */
  -    public static char[] hex(byte[] data) {
  +    public static char[] encodeHex(byte[] data) {
   
   	   int l = data.length;
   
  @@ -101,7 +101,7 @@
          given byte. An exception is thrown if the passed char array has an odd
          number of elements.
       */
  -    public static byte[] hexdecode(char[] data) throws Exception {
  +    public static byte[] decodeHex(char[] data) throws Exception {
   	
   	   int l = data.length;
   
  
  
  
  1.7       +2 -2      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DoubleMetaphone.java	25 Feb 2003 07:51:51 -0000	1.6
  +++ DoubleMetaphone.java	25 Feb 2003 08:19:40 -0000	1.7
  @@ -341,7 +341,7 @@
      * @param in the string to encode
      * @return the encoded string
      */ 
  -  public static String sencode( String in ) throws EncoderException {
  +  public static String encodeDoubleMetaphone( String in ) throws EncoderException {
       DoubleMetaphone dm = new DoubleMetaphone();
       return dm.encode(in);
     }
  
  
  
  1.6       +3 -3      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Nysiis.java	25 Feb 2003 07:51:51 -0000	1.5
  +++ Nysiis.java	25 Feb 2003 08:19:40 -0000	1.6
  @@ -83,7 +83,7 @@
      * @param word the data to encode.
      * @return the encoded string.
      */
  -  public static String sencode( String word ) throws EncoderException {
  +  public static String encodeNysiis( String word ) throws EncoderException {
       Nysiis ny = new Nysiis();
       return ny.encode(word);
     }
  @@ -353,7 +353,7 @@
      * @return true/false
      */
     public static boolean isEncodeEqual( String s1, String s2 ) throws EncoderException {
  -    return sencode( s1 ).equals( sencode( s2 ) );
  +    return encodeNysiis( s1 ).equals( encodeNysiis( s2 ) );
     }
   }
   
  
  
  
  1.6       +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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestBase64.java	25 Feb 2003 07:51:51 -0000	1.5
  +++ TestBase64.java	25 Feb 2003 08:19:40 -0000	1.6
  @@ -111,7 +111,7 @@
       public void testBase64() {
           String content = "Hello World";
           String encodedContent;
  -        encodedContent = new String(Base64.base64(content.getBytes()));
  +        encodedContent = new String(Base64.encodeBase64(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.base64(data);
  +            byte[] enc =  Base64.encodeBase64(data);
               assertTrue("\"" + (new String(enc)) + "\" is Base64 data.",Base64.isArrayByteBase64(enc)
);
  -            byte[] data2 = Base64.base64decode(enc);
  +            byte[] data2 = Base64.decodeBase64(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.base64(data);
  +            byte[] enc =  Base64.encodeBase64(data);
               assertTrue(Base64.isArrayByteBase64(enc));
  -            byte[] data2 = Base64.base64decode(enc);
  +            byte[] data2 = Base64.decodeBase64(enc);
               assertTrue(Arrays.equals(data,data2));
           }
       }
   
       public void testSingletons() {
  -        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 })));
  +        assertEquals("AA==",new String(Base64.encodeBase64(new byte[] { (byte)0 })));
  +        assertEquals("AQ==",new String(Base64.encodeBase64(new byte[] { (byte)1 })));
  +        assertEquals("Ag==",new String(Base64.encodeBase64(new byte[] { (byte)2 })));
  +        assertEquals("Aw==",new String(Base64.encodeBase64(new byte[] { (byte)3 })));
  +        assertEquals("BA==",new String(Base64.encodeBase64(new byte[] { (byte)4 })));
  +        assertEquals("BQ==",new String(Base64.encodeBase64(new byte[] { (byte)5 })));
  +        assertEquals("Bg==",new String(Base64.encodeBase64(new byte[] { (byte)6 })));
  +        assertEquals("Bw==",new String(Base64.encodeBase64(new byte[] { (byte)7 })));
  +        assertEquals("CA==",new String(Base64.encodeBase64(new byte[] { (byte)8 })));
  +        assertEquals("CQ==",new String(Base64.encodeBase64(new byte[] { (byte)9 })));
  +        assertEquals("Cg==",new String(Base64.encodeBase64(new byte[] { (byte)10 })));
  +        assertEquals("Cw==",new String(Base64.encodeBase64(new byte[] { (byte)11 })));
  +        assertEquals("DA==",new String(Base64.encodeBase64(new byte[] { (byte)12 })));
  +        assertEquals("DQ==",new String(Base64.encodeBase64(new byte[] { (byte)13 })));
  +        assertEquals("Dg==",new String(Base64.encodeBase64(new byte[] { (byte)14 })));
  +        assertEquals("Dw==",new String(Base64.encodeBase64(new byte[] { (byte)15 })));
  +        assertEquals("EA==",new String(Base64.encodeBase64(new byte[] { (byte)16 })));
  +        assertEquals("EQ==",new String(Base64.encodeBase64(new byte[] { (byte)17 })));
  +        assertEquals("Eg==",new String(Base64.encodeBase64(new byte[] { (byte)18 })));
  +        assertEquals("Ew==",new String(Base64.encodeBase64(new byte[] { (byte)19 })));
  +        assertEquals("FA==",new String(Base64.encodeBase64(new byte[] { (byte)20 })));
  +        assertEquals("FQ==",new String(Base64.encodeBase64(new byte[] { (byte)21 })));
  +        assertEquals("Fg==",new String(Base64.encodeBase64(new byte[] { (byte)22 })));
  +        assertEquals("Fw==",new String(Base64.encodeBase64(new byte[] { (byte)23 })));
  +        assertEquals("GA==",new String(Base64.encodeBase64(new byte[] { (byte)24 })));
  +        assertEquals("GQ==",new String(Base64.encodeBase64(new byte[] { (byte)25 })));
  +        assertEquals("Gg==",new String(Base64.encodeBase64(new byte[] { (byte)26 })));
  +        assertEquals("Gw==",new String(Base64.encodeBase64(new byte[] { (byte)27 })));
  +        assertEquals("HA==",new String(Base64.encodeBase64(new byte[] { (byte)28 })));
  +        assertEquals("HQ==",new String(Base64.encodeBase64(new byte[] { (byte)29 })));
  +        assertEquals("Hg==",new String(Base64.encodeBase64(new byte[] { (byte)30 })));
  +        assertEquals("Hw==",new String(Base64.encodeBase64(new byte[] { (byte)31 })));
  +        assertEquals("IA==",new String(Base64.encodeBase64(new byte[] { (byte)32 })));
  +        assertEquals("IQ==",new String(Base64.encodeBase64(new byte[] { (byte)33 })));
  +        assertEquals("Ig==",new String(Base64.encodeBase64(new byte[] { (byte)34 })));
  +        assertEquals("Iw==",new String(Base64.encodeBase64(new byte[] { (byte)35 })));
  +        assertEquals("JA==",new String(Base64.encodeBase64(new byte[] { (byte)36 })));
  +        assertEquals("JQ==",new String(Base64.encodeBase64(new byte[] { (byte)37 })));
  +        assertEquals("Jg==",new String(Base64.encodeBase64(new byte[] { (byte)38 })));
  +        assertEquals("Jw==",new String(Base64.encodeBase64(new byte[] { (byte)39 })));
  +        assertEquals("KA==",new String(Base64.encodeBase64(new byte[] { (byte)40 })));
  +        assertEquals("KQ==",new String(Base64.encodeBase64(new byte[] { (byte)41 })));
  +        assertEquals("Kg==",new String(Base64.encodeBase64(new byte[] { (byte)42 })));
  +        assertEquals("Kw==",new String(Base64.encodeBase64(new byte[] { (byte)43 })));
  +        assertEquals("LA==",new String(Base64.encodeBase64(new byte[] { (byte)44 })));
  +        assertEquals("LQ==",new String(Base64.encodeBase64(new byte[] { (byte)45 })));
  +        assertEquals("Lg==",new String(Base64.encodeBase64(new byte[] { (byte)46 })));
  +        assertEquals("Lw==",new String(Base64.encodeBase64(new byte[] { (byte)47 })));
  +        assertEquals("MA==",new String(Base64.encodeBase64(new byte[] { (byte)48 })));
  +        assertEquals("MQ==",new String(Base64.encodeBase64(new byte[] { (byte)49 })));
  +        assertEquals("Mg==",new String(Base64.encodeBase64(new byte[] { (byte)50 })));
  +        assertEquals("Mw==",new String(Base64.encodeBase64(new byte[] { (byte)51 })));
  +        assertEquals("NA==",new String(Base64.encodeBase64(new byte[] { (byte)52 })));
  +        assertEquals("NQ==",new String(Base64.encodeBase64(new byte[] { (byte)53 })));
  +        assertEquals("Ng==",new String(Base64.encodeBase64(new byte[] { (byte)54 })));
  +        assertEquals("Nw==",new String(Base64.encodeBase64(new byte[] { (byte)55 })));
  +        assertEquals("OA==",new String(Base64.encodeBase64(new byte[] { (byte)56 })));
  +        assertEquals("OQ==",new String(Base64.encodeBase64(new byte[] { (byte)57 })));
  +        assertEquals("Og==",new String(Base64.encodeBase64(new byte[] { (byte)58 })));
  +        assertEquals("Ow==",new String(Base64.encodeBase64(new byte[] { (byte)59 })));
  +        assertEquals("PA==",new String(Base64.encodeBase64(new byte[] { (byte)60 })));
  +        assertEquals("PQ==",new String(Base64.encodeBase64(new byte[] { (byte)61 })));
  +        assertEquals("Pg==",new String(Base64.encodeBase64(new byte[] { (byte)62 })));
  +        assertEquals("Pw==",new String(Base64.encodeBase64(new byte[] { (byte)63 })));
  +        assertEquals("QA==",new String(Base64.encodeBase64(new byte[] { (byte)64 })));
  +        assertEquals("QQ==",new String(Base64.encodeBase64(new byte[] { (byte)65 })));
  +        assertEquals("Qg==",new String(Base64.encodeBase64(new byte[] { (byte)66 })));
  +        assertEquals("Qw==",new String(Base64.encodeBase64(new byte[] { (byte)67 })));
  +        assertEquals("RA==",new String(Base64.encodeBase64(new byte[] { (byte)68 })));
  +        assertEquals("RQ==",new String(Base64.encodeBase64(new byte[] { (byte)69 })));
  +        assertEquals("Rg==",new String(Base64.encodeBase64(new byte[] { (byte)70 })));
  +        assertEquals("Rw==",new String(Base64.encodeBase64(new byte[] { (byte)71 })));
  +        assertEquals("SA==",new String(Base64.encodeBase64(new byte[] { (byte)72 })));
  +        assertEquals("SQ==",new String(Base64.encodeBase64(new byte[] { (byte)73 })));
  +        assertEquals("Sg==",new String(Base64.encodeBase64(new byte[] { (byte)74 })));
  +        assertEquals("Sw==",new String(Base64.encodeBase64(new byte[] { (byte)75 })));
  +        assertEquals("TA==",new String(Base64.encodeBase64(new byte[] { (byte)76 })));
  +        assertEquals("TQ==",new String(Base64.encodeBase64(new byte[] { (byte)77 })));
  +        assertEquals("Tg==",new String(Base64.encodeBase64(new byte[] { (byte)78 })));
  +        assertEquals("Tw==",new String(Base64.encodeBase64(new byte[] { (byte)79 })));
  +        assertEquals("UA==",new String(Base64.encodeBase64(new byte[] { (byte)80 })));
  +        assertEquals("UQ==",new String(Base64.encodeBase64(new byte[] { (byte)81 })));
  +        assertEquals("Ug==",new String(Base64.encodeBase64(new byte[] { (byte)82 })));
  +        assertEquals("Uw==",new String(Base64.encodeBase64(new byte[] { (byte)83 })));
  +        assertEquals("VA==",new String(Base64.encodeBase64(new byte[] { (byte)84 })));
  +        assertEquals("VQ==",new String(Base64.encodeBase64(new byte[] { (byte)85 })));
  +        assertEquals("Vg==",new String(Base64.encodeBase64(new byte[] { (byte)86 })));
  +        assertEquals("Vw==",new String(Base64.encodeBase64(new byte[] { (byte)87 })));
  +        assertEquals("WA==",new String(Base64.encodeBase64(new byte[] { (byte)88 })));
  +        assertEquals("WQ==",new String(Base64.encodeBase64(new byte[] { (byte)89 })));
  +        assertEquals("Wg==",new String(Base64.encodeBase64(new byte[] { (byte)90 })));
  +        assertEquals("Ww==",new String(Base64.encodeBase64(new byte[] { (byte)91 })));
  +        assertEquals("XA==",new String(Base64.encodeBase64(new byte[] { (byte)92 })));
  +        assertEquals("XQ==",new String(Base64.encodeBase64(new byte[] { (byte)93 })));
  +        assertEquals("Xg==",new String(Base64.encodeBase64(new byte[] { (byte)94 })));
  +        assertEquals("Xw==",new String(Base64.encodeBase64(new byte[] { (byte)95 })));
  +        assertEquals("YA==",new String(Base64.encodeBase64(new byte[] { (byte)96 })));
  +        assertEquals("YQ==",new String(Base64.encodeBase64(new byte[] { (byte)97 })));
  +        assertEquals("Yg==",new String(Base64.encodeBase64(new byte[] { (byte)98 })));
  +        assertEquals("Yw==",new String(Base64.encodeBase64(new byte[] { (byte)99 })));
  +        assertEquals("ZA==",new String(Base64.encodeBase64(new byte[] { (byte)100 })));
  +        assertEquals("ZQ==",new String(Base64.encodeBase64(new byte[] { (byte)101 })));
  +        assertEquals("Zg==",new String(Base64.encodeBase64(new byte[] { (byte)102 })));
  +        assertEquals("Zw==",new String(Base64.encodeBase64(new byte[] { (byte)103 })));
  +        assertEquals("aA==",new String(Base64.encodeBase64(new byte[] { (byte)104 })));
       }
   
       public void testTriplets() {
  -        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
})));
  +        assertEquals("AAAA",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)0 })));
  +        assertEquals("AAAB",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)1 })));
  +        assertEquals("AAAC",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)2 })));
  +        assertEquals("AAAD",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)3 })));
  +        assertEquals("AAAE",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)4 })));
  +        assertEquals("AAAF",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)5 })));
  +        assertEquals("AAAG",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)6 })));
  +        assertEquals("AAAH",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)7 })));
  +        assertEquals("AAAI",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)8 })));
  +        assertEquals("AAAJ",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)9 })));
  +        assertEquals("AAAK",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)10 })));
  +        assertEquals("AAAL",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)11 })));
  +        assertEquals("AAAM",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)12 })));
  +        assertEquals("AAAN",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)13 })));
  +        assertEquals("AAAO",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)14 })));
  +        assertEquals("AAAP",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)15 })));
  +        assertEquals("AAAQ",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)16 })));
  +        assertEquals("AAAR",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)17 })));
  +        assertEquals("AAAS",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)18 })));
  +        assertEquals("AAAT",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)19 })));
  +        assertEquals("AAAU",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)20 })));
  +        assertEquals("AAAV",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)21 })));
  +        assertEquals("AAAW",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)22 })));
  +        assertEquals("AAAX",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)23 })));
  +        assertEquals("AAAY",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)24 })));
  +        assertEquals("AAAZ",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)25 })));
  +        assertEquals("AAAa",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)26 })));
  +        assertEquals("AAAb",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)27 })));
  +        assertEquals("AAAc",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)28 })));
  +        assertEquals("AAAd",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)29 })));
  +        assertEquals("AAAe",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)30 })));
  +        assertEquals("AAAf",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)31 })));
  +        assertEquals("AAAg",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)32 })));
  +        assertEquals("AAAh",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)33 })));
  +        assertEquals("AAAi",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)34 })));
  +        assertEquals("AAAj",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)35 })));
  +        assertEquals("AAAk",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)36 })));
  +        assertEquals("AAAl",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)37 })));
  +        assertEquals("AAAm",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)38 })));
  +        assertEquals("AAAn",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)39 })));
  +        assertEquals("AAAo",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)40 })));
  +        assertEquals("AAAp",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)41 })));
  +        assertEquals("AAAq",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)42 })));
  +        assertEquals("AAAr",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)43 })));
  +        assertEquals("AAAs",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)44 })));
  +        assertEquals("AAAt",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)45 })));
  +        assertEquals("AAAu",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)46 })));
  +        assertEquals("AAAv",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)47 })));
  +        assertEquals("AAAw",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)48 })));
  +        assertEquals("AAAx",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)49 })));
  +        assertEquals("AAAy",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)50 })));
  +        assertEquals("AAAz",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)51 })));
  +        assertEquals("AAA0",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)52 })));
  +        assertEquals("AAA1",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)53 })));
  +        assertEquals("AAA2",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)54 })));
  +        assertEquals("AAA3",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)55 })));
  +        assertEquals("AAA4",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)56 })));
  +        assertEquals("AAA5",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)57 })));
  +        assertEquals("AAA6",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)58 })));
  +        assertEquals("AAA7",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)59 })));
  +        assertEquals("AAA8",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)60 })));
  +        assertEquals("AAA9",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)61 })));
  +        assertEquals("AAA+",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)62 })));
  +        assertEquals("AAA/",new String(Base64.encodeBase64(new byte[] { (byte)0, (byte)0,
(byte)63 })));
       }
   
       public void testKnownEncodings() {
  -        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())));
  +        assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==",new
String(Base64.encodeBase64("The quick brown fox jumped over the lazy dogs.".getBytes())));
  +	assertEquals("YmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJs\nYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFo\nIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBi\nbGFoIGJsYWg=\n",new
String(Base64.encodeBase64Chunked("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.encodeBase64("It was the best of times, it was the worst of times.".getBytes())));
  +        assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==",new String(Base64.encodeBase64("http://jakarta.apache.org/commmons".getBytes())));
  +        assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==",new
String(Base64.encodeBase64("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())));
  +        assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=",new String(Base64.encodeBase64("{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())));
  +        assertEquals("eHl6enkh",new String(Base64.encodeBase64("xyzzy!".getBytes())));
       }
   
       public void testKnownDecodings() {
  -        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())));
  +        assertEquals("The quick brown fox jumped over the lazy dogs.",new String(Base64.decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes())));
  +        assertEquals("It was the best of times, it was the worst of times.",new String(Base64.decodeBase64("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==".getBytes())));
  +        assertEquals("http://jakarta.apache.org/commmons",new String(Base64.decodeBase64("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==".getBytes())));
  +        assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",new String(Base64.decodeBase64("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==".getBytes())));
  +        assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }",new String(Base64.decodeBase64("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=".getBytes())));
  +        assertEquals("xyzzy!",new String(Base64.decodeBase64("eHl6enkh".getBytes())));
       }
   
       // -------------------------------------------------------- Private Methods
  
  
  
  1.3       +8 -8      jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/binary/TestHex.java
  
  Index: TestHex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/binary/TestHex.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestHex.java	25 Feb 2003 07:51:51 -0000	1.2
  +++ TestHex.java	25 Feb 2003 08:19:40 -0000	1.3
  @@ -96,12 +96,12 @@
       }
   
       public void testEncodeEmpty() throws Exception {
  -        char[] c = Hex.hex(new byte[0]);
  +        char[] c = Hex.encodeHex(new byte[0]);
           assertTrue(Arrays.equals(new char[0], c));
       }
   
       public void testEncodeZeroes() throws Exception {
  -        char[] c = Hex.hex(new byte[36]);
  +        char[] c = Hex.encodeHex(new byte[36]);
           assertEquals(
               "000000000000000000000000000000000000"
                   + "000000000000000000000000000000000000",
  @@ -110,7 +110,7 @@
   
       public void testHelloWorld() throws Exception {
           byte[] b = "Hello World".getBytes();
  -        char[] c = Hex.hex(b);
  +        char[] c = Hex.encodeHex(b);
           assertEquals("48656c6c6f20576f726c64", new String(c));
       }
   
  @@ -121,8 +121,8 @@
               byte[] data = new byte[random.nextInt(10000) + 1];
               random.nextBytes(data);
   
  -            char[] enc = Hex.hex(data);
  -            byte[] data2 = Hex.hexdecode(enc);
  +            char[] enc = Hex.encodeHex(data);
  +            byte[] data2 = Hex.decodeHex(enc);
   
               assertTrue(Arrays.equals(data, data2));
           }
  
  
  

---------------------------------------------------------------------
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