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

Side by Side Diff: pkg/polymer/lib/src/file_system/console.dart

Issue 22909059: Some more removals of dart:utf. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change ArgumentError to FormatException. Created 7 years, 3 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
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 console; 5 library console;
6 6
7 import 'dart:async'; 7 import 'dart:convert';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:utf';
10 import 'package:polymer/src/file_system.dart'; 9 import 'package:polymer/src/file_system.dart';
11 10
12 /** File system implementation for console VM (i.e. no browser). */ 11 /** File system implementation for console VM (i.e. no browser). */
13 class ConsoleFileSystem implements FileSystem { 12 class ConsoleFileSystem implements FileSystem {
14 13
15 /** Pending futures for file write requests. */ 14 /** Pending futures for file write requests. */
16 final _pending = <String, Future>{}; 15 final _pending = <String, Future>{};
17 16
18 Future flush() => Future.wait(_pending.values.toList()); 17 Future flush() => Future.wait(_pending.values.toList());
19 18
(...skipping 15 matching lines...) Expand all
35 // TODO(jmesserly): is this guaranteed to read all of the bytes? 34 // TODO(jmesserly): is this guaranteed to read all of the bytes?
36 var buffer = new List<int>(length); 35 var buffer = new List<int>(length);
37 return file.readInto(buffer, 0, length) 36 return file.readInto(buffer, 0, length)
38 .then((_) => file.close()) 37 .then((_) => file.close())
39 .then((_) => buffer); 38 .then((_) => buffer);
40 })); 39 }));
41 } 40 }
42 41
43 // TODO(jmesserly): do we support any encoding other than UTF-8 for Dart? 42 // TODO(jmesserly): do we support any encoding other than UTF-8 for Dart?
44 Future<String> readText(String path) { 43 Future<String> readText(String path) {
45 return readTextOrBytes(path).then(decodeUtf8); 44 return readTextOrBytes(path).then(UTF8.decode);
46 } 45 }
47 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698