Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(871)

Side by Side Diff: sdk/lib/io/base64.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/io/http_headers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 class _Base64 { 7 class _Base64 {
8 static const List<String> _encodingTable = const [ 8 static const List<String> _encodingTable = const [
9 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 9 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
10 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 10 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 /** 62 /**
63 * Base64 transfer decoding for MIME (RFC 2045). 63 * Base64 transfer decoding for MIME (RFC 2045).
64 */ 64 */
65 static List<int> _decode(String data) { 65 static List<int> _decode(String data) {
66 List<int> result = new List<int>(); 66 List<int> result = new List<int>();
67 int padCount = 0; 67 int padCount = 0;
68 int charCount = 0; 68 int charCount = 0;
69 int value = 0; 69 int value = 0;
70 for (int i = 0; i < data.length; i++) { 70 for (int i = 0; i < data.length; i++) {
71 int char = data.charCodeAt(i); 71 int char = data.codeUnitAt(i);
72 if (65 <= char && char <= 90) { // "A" - "Z". 72 if (65 <= char && char <= 90) { // "A" - "Z".
73 value = (value << 6) | char - 65; 73 value = (value << 6) | char - 65;
74 charCount++; 74 charCount++;
75 } else if (97 <= char && char <= 122) { // "a" - "z". 75 } else if (97 <= char && char <= 122) { // "a" - "z".
76 value = (value << 6) | char - 97 + 26; 76 value = (value << 6) | char - 97 + 26;
77 charCount++; 77 charCount++;
78 } else if (48 <= char && char <= 57) { // "0" - "9". 78 } else if (48 <= char && char <= 57) { // "0" - "9".
79 value = (value << 6) | char - 48 + 52; 79 value = (value << 6) | char - 48 + 52;
80 charCount++; 80 charCount++;
81 } else if (char == 43) { // "+". 81 } else if (char == 43) { // "+".
(...skipping 15 matching lines...) Expand all
97 if (padCount == 0) { 97 if (padCount == 0) {
98 result.add(value & 0xFF); 98 result.add(value & 0xFF);
99 } 99 }
100 charCount = 0; 100 charCount = 0;
101 value = 0; 101 value = 0;
102 } 102 }
103 } 103 }
104 return result; 104 return result;
105 } 105 }
106 } 106 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/io/http_headers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698