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

Side by Side Diff: pkg/http/lib/src/utils.dart

Issue 11312203: "Reverting 14829-14832" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « pkg/args/test/args_test.dart ('k') | pkg/intl/lib/bidi_utils.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 library utils; 5 library utils;
6 6
7 import 'dart:crypto'; 7 import 'dart:crypto';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:scalarlist'; 10 import 'dart:scalarlist';
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 /// Converts [string] into a byte array according to [encoding]. 109 /// Converts [string] into a byte array according to [encoding].
110 List<int> encodeString(String string, Encoding encoding) { 110 List<int> encodeString(String string, Encoding encoding) {
111 // TODO(nweiz): implement this once issue 6284 is fixed. 111 // TODO(nweiz): implement this once issue 6284 is fixed.
112 return string.charCodes; 112 return string.charCodes;
113 } 113 }
114 114
115 /// A regular expression that matches strings that are composed entirely of 115 /// A regular expression that matches strings that are composed entirely of
116 /// ASCII-compatible characters. 116 /// ASCII-compatible characters.
117 final RegExp _ASCII_ONLY = new RegExp(r"^[\x00-\x7F]+$"); 117 final RegExp _ASCII_ONLY = const RegExp(r"^[\x00-\x7F]+$");
118 118
119 /// Returns whether [string] is composed entirely of ASCII-compatible 119 /// Returns whether [string] is composed entirely of ASCII-compatible
120 /// characters. 120 /// characters.
121 bool isPlainAscii(String string) => _ASCII_ONLY.hasMatch(string); 121 bool isPlainAscii(String string) => _ASCII_ONLY.hasMatch(string);
122 122
123 /// Converts [input] into a [Uint8List]. If [input] is a [ByteArray] or 123 /// Converts [input] into a [Uint8List]. If [input] is a [ByteArray] or
124 /// [ByteArrayViewable], this just returns a view on [input]. 124 /// [ByteArrayViewable], this just returns a view on [input].
125 Uint8List toUint8List(List<int> input) { 125 Uint8List toUint8List(List<int> input) {
126 if (input is Uint8List) return input; 126 if (input is Uint8List) return input;
127 if (input is ByteArrayViewable) input = input.asByteArray(); 127 if (input is ByteArrayViewable) input = input.asByteArray();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 /// Configures [future] so that its result (success or exception) is passed on 200 /// Configures [future] so that its result (success or exception) is passed on
201 /// to [completer]. 201 /// to [completer].
202 void chainToCompleter(Future future, Completer completer) { 202 void chainToCompleter(Future future, Completer completer) {
203 future.handleException((e) { 203 future.handleException((e) {
204 completer.completeException(e); 204 completer.completeException(e);
205 return true; 205 return true;
206 }); 206 });
207 future.then(completer.complete); 207 future.then(completer.complete);
208 } 208 }
OLDNEW
« no previous file with comments | « pkg/args/test/args_test.dart ('k') | pkg/intl/lib/bidi_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698