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

Side by Side Diff: utils/pub/io.dart

Issue 11412033: Rename File.readAsText to File.readAsString. There is no Text type in Dart (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 | « utils/apidoc/mdn/util.dart ('k') | no next file » | 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 /** 5 /**
6 * Helper functionality to make working with IO easier. 6 * Helper functionality to make working with IO easier.
7 */ 7 */
8 library io; 8 library io;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 */ 111 */
112 Future<bool> fileExists(file) { 112 Future<bool> fileExists(file) {
113 return new File(_getPath(file)).exists(); 113 return new File(_getPath(file)).exists();
114 } 114 }
115 115
116 /** 116 /**
117 * Reads the contents of the text file [file], which can either be a [String] or 117 * Reads the contents of the text file [file], which can either be a [String] or
118 * a [File]. 118 * a [File].
119 */ 119 */
120 Future<String> readTextFile(file) { 120 Future<String> readTextFile(file) {
121 return new File(_getPath(file)).readAsText(Encoding.UTF_8); 121 return new File(_getPath(file)).readAsString(Encoding.UTF_8);
122 } 122 }
123 123
124 /** 124 /**
125 * Creates [file] (which can either be a [String] or a [File]), and writes 125 * Creates [file] (which can either be a [String] or a [File]), and writes
126 * [contents] to it. Completes when the file is written and closed. 126 * [contents] to it. Completes when the file is written and closed.
127 */ 127 */
128 Future<File> writeTextFile(file, String contents) { 128 Future<File> writeTextFile(file, String contents) {
129 file = new File(_getPath(file)); 129 file = new File(_getPath(file));
130 return file.open(FileMode.WRITE).chain((opened) { 130 return file.open(FileMode.WRITE).chain((opened) {
131 return opened.writeString(contents).chain((ignore) { 131 return opened.writeString(contents).chain((ignore) {
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 return new Directory(entry); 746 return new Directory(entry);
747 } 747 }
748 748
749 /** 749 /**
750 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. 750 * Gets a [Uri] for [uri], which can either already be one, or be a [String].
751 */ 751 */
752 Uri _getUri(uri) { 752 Uri _getUri(uri) {
753 if (uri is Uri) return uri; 753 if (uri is Uri) return uri;
754 return new Uri.fromString(uri); 754 return new Uri.fromString(uri);
755 } 755 }
OLDNEW
« no previous file with comments | « utils/apidoc/mdn/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698