OLD | NEW |
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 /** | 6 /** |
7 * FileMode describes the modes in which a file can be opened. | 7 * FileMode describes the modes in which a file can be opened. |
8 */ | 8 */ |
9 class FileMode { | 9 class FileMode { |
10 static const READ = const FileMode._internal(0); | 10 static const READ = const FileMode._internal(0); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 * is the contents of the file. | 177 * is the contents of the file. |
178 */ | 178 */ |
179 Future<List<int>> readAsBytes(); | 179 Future<List<int>> readAsBytes(); |
180 | 180 |
181 /** | 181 /** |
182 * Synchronously read the entire file contents as a list of bytes. | 182 * Synchronously read the entire file contents as a list of bytes. |
183 */ | 183 */ |
184 List<int> readAsBytesSync(); | 184 List<int> readAsBytesSync(); |
185 | 185 |
186 /** | 186 /** |
187 * Read the entire file contents as text using the given | 187 * Read the entire file contents as a string using the given |
188 * [encoding]. | 188 * [encoding]. |
189 * | 189 * |
190 * Returns a [:Future<String>:] that completes with the string once | 190 * Returns a [:Future<String>:] that completes with the string once |
191 * the file contents has been read. | 191 * the file contents has been read. |
192 */ | 192 */ |
193 Future<String> readAsText([Encoding encoding = Encoding.UTF_8]); | 193 Future<String> readAsString([Encoding encoding = Encoding.UTF_8]); |
194 | 194 |
195 /** | 195 /** |
196 * Synchronously read the entire file contents as text using the | 196 * Synchronously read the entire file contents as a string using the |
197 * given [encoding]. | 197 * given [encoding]. |
198 */ | 198 */ |
199 String readAsTextSync([Encoding encoding = Encoding.UTF_8]); | 199 String readAsStringSync([Encoding encoding = Encoding.UTF_8]); |
200 | 200 |
201 /** | 201 /** |
202 * Read the entire file contents as lines of text using the give | 202 * Read the entire file contents as lines of text using the give |
203 * [encoding]. | 203 * [encoding]. |
204 * | 204 * |
205 * Returns a [:Future<List<String>>:] that completes with the lines | 205 * Returns a [:Future<List<String>>:] that completes with the lines |
206 * once the file contents has been read. | 206 * once the file contents has been read. |
207 */ | 207 */ |
208 Future<List<String>> readAsLines([Encoding encoding = Encoding.UTF_8]); | 208 Future<List<String>> readAsLines([Encoding encoding = Encoding.UTF_8]); |
209 | 209 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 sb.add(" ($osError)"); | 380 sb.add(" ($osError)"); |
381 } | 381 } |
382 } else if (osError != null) { | 382 } else if (osError != null) { |
383 sb.add(": osError"); | 383 sb.add(": osError"); |
384 } | 384 } |
385 return sb.toString(); | 385 return sb.toString(); |
386 } | 386 } |
387 final String message; | 387 final String message; |
388 final OSError osError; | 388 final OSError osError; |
389 } | 389 } |
OLD | NEW |