ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Get.java
Date Fri, 06 May 2005 18:38:34 GMT
mbenson     2005/05/06 11:38:34

  Modified:    src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
                        Get.java
  Log:
  Sync with HEAD
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.38.2.7  +22 -26    ant/src/main/org/apache/tools/ant/taskdefs/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
  retrieving revision 1.38.2.6
  retrieving revision 1.38.2.7
  diff -u -r1.38.2.6 -r1.38.2.7
  --- Get.java	1 Mar 2005 23:15:09 -0000	1.38.2.6
  +++ Get.java	6 May 2005 18:38:34 -0000	1.38.2.7
  @@ -343,30 +343,27 @@
       *
       *********************************************************************/
   
  -    protected static class  Base64Converter {
  +    protected static class Base64Converter {
   
  -        public final char [ ]  alphabet = {
  -            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',   //  0 to  7
  -            'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',   //  8 to 15
  -            'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',   // 16 to 23
  -            'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',   // 24 to 31
  -            'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',   // 32 to 39
  -            'o', 'p', 'q', 'r', 's', 't', 'u', 'v',   // 40 to 47
  -            'w', 'x', 'y', 'z', '0', '1', '2', '3',   // 48 to 55
  -            '4', '5', '6', '7', '8', '9', '+', '/' }; // 56 to 63
  -
  -
  -        public String  encode(String  s) {
  -            return encode (s.getBytes());
  -        }
  -
  -        public String  encode(byte[ ] octetString) {
  -            int  bits24;
  -            int  bits6;
  -
  -            char [ ]  out
  -              = new char[((octetString.length - 1) / 3 + 1) * 4];
  +        public final char[] alphabet = {
  +            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',  //  0 to  7
  +            'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',  //  8 to 15
  +            'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',  // 16 to 23
  +            'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',  // 24 to 31
  +            'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',  // 32 to 39
  +            'o', 'p', 'q', 'r', 's', 't', 'u', 'v',  // 40 to 47
  +            'w', 'x', 'y', 'z', '0', '1', '2', '3',  // 48 to 55
  +            '4', '5', '6', '7', '8', '9', '+', '/'}; // 56 to 63
  +
  +        public String encode(String s) {
  +            return encode(s.getBytes());
  +        }
  +
  +        public String encode(byte[] octetString) {
  +            int bits24;
  +            int bits6;
   
  +            char[] out = new char[((octetString.length - 1) / 3 + 1) * 4];
               int outIndex = 0;
               int i = 0;
   
  @@ -374,6 +371,7 @@
                   // store the octets
                   bits24 = (octetString[i++] & 0xFF) << 16;
                   bits24 |= (octetString[i++] & 0xFF) << 8;
  +                bits24 |= octetString[i++];
   
                   bits6 = (bits24 & 0x00FC0000) >> 18;
                   out[outIndex++] = alphabet[bits6];
  @@ -384,7 +382,6 @@
                   bits6 = (bits24 & 0x0000003F);
                   out[outIndex++] = alphabet[bits6];
               }
  -
               if (octetString.length - i == 2) {
                   // store the octets
                   bits24 = (octetString[i] & 0xFF) << 16;
  @@ -404,16 +401,15 @@
                   bits6 = (bits24 & 0x00FC0000) >> 18;
                   out[outIndex++] = alphabet[bits6];
                   bits6 = (bits24 & 0x0003F000) >> 12;
  -                out[outIndex++] = alphabet[ bits6 ];
  +                out[outIndex++] = alphabet[bits6];
   
                   // padding
                   out[outIndex++] = '=';
                   out[outIndex++] = '=';
               }
  -
               return new String(out);
           }
  -     }
  +    }
   
       public interface DownloadProgress {
           /**
  
  
  

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


Mime
View raw message