OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 part of webdriver; |
| 6 |
1 /** | 7 /** |
2 * A simple base64 decoder class, used to decode web browser screenshots | 8 * A simple base64 decoder class, used to decode web browser screenshots |
3 * returned by WebDriver. | 9 * returned by WebDriver. |
4 */ | 10 */ |
5 class Base64Decoder { | 11 class Base64Decoder { |
6 | 12 |
7 static int getVal(String s, pos) { | 13 static int getVal(String s, pos) { |
8 int code = s.charCodeAt(pos); | 14 int code = s.charCodeAt(pos); |
9 if (code >= 65 && code < (65+26)) { // 'A'..'Z' | 15 if (code >= 65 && code < (65+26)) { // 'A'..'Z' |
10 return code - 65; | 16 return code - 65; |
(...skipping 29 matching lines...) Expand all Loading... |
40 (getVal(s, pos + 2) << 6) | getVal(s, pos+3); | 46 (getVal(s, pos + 2) << 6) | getVal(s, pos+3); |
41 pos += 4; | 47 pos += 4; |
42 rtn.add((v >> 16 ) & 0xff); | 48 rtn.add((v >> 16 ) & 0xff); |
43 rtn.add((v >> 8) & 0xff); | 49 rtn.add((v >> 8) & 0xff); |
44 rtn.add(v & 0xff); | 50 rtn.add(v & 0xff); |
45 } | 51 } |
46 } | 52 } |
47 return rtn; | 53 return rtn; |
48 } | 54 } |
49 } | 55 } |
OLD | NEW |