changeset 33547 | e4c76ac38b12 |
parent 28326 | 2b9860c0d68a |
child 43852 | 93a527059d8a |
33390:d131f4b8433a | 33547:e4c76ac38b12 |
---|---|
1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
45 static private final int BASELENGTH = 255; |
45 static private final int BASELENGTH = 255; |
46 static private final int LOOKUPLENGTH = 63; |
46 static private final int LOOKUPLENGTH = 63; |
47 static private final int TWENTYFOURBITGROUP = 24; |
47 static private final int TWENTYFOURBITGROUP = 24; |
48 static private final int EIGHTBIT = 8; |
48 static private final int EIGHTBIT = 8; |
49 static private final int SIXTEENBIT = 16; |
49 static private final int SIXTEENBIT = 16; |
50 static private final int SIXBIT = 6; |
|
51 static private final int FOURBYTE = 4; |
50 static private final int FOURBYTE = 4; |
52 |
51 |
53 |
52 |
54 static private final byte PAD = ( byte ) '='; |
53 static private final byte PAD = ( byte ) '='; |
55 static private byte [] base64Alphabet = new byte[BASELENGTH]; |
54 static private byte [] base64Alphabet = new byte[BASELENGTH]; |
242 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 |
241 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 |
243 }; |
242 }; |
244 |
243 |
245 public static String base64Decode( String orig ) { |
244 public static String base64Decode( String orig ) { |
246 char chars[]=orig.toCharArray(); |
245 char chars[]=orig.toCharArray(); |
247 StringBuffer sb=new StringBuffer(); |
246 StringBuilder sb=new StringBuilder(); |
248 int i=0; |
247 int i=0; |
249 |
248 |
250 int shift = 0; // # of excess bits stored in accum |
249 int shift = 0; // # of excess bits stored in accum |
251 int acc = 0; |
250 int acc = 0; |
252 |
251 |