| 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 final READ = const FileMode._internal(0); | 10 static final READ = const FileMode._internal(0); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 /** | 216 /** |
| 217 * Synchronously read the entire file contents as lines of text | 217 * Synchronously read the entire file contents as lines of text |
| 218 * using the given [encoding] The default encoding is | 218 * using the given [encoding] The default encoding is |
| 219 * [:Encoding.UTF_8:]. | 219 * [:Encoding.UTF_8:]. |
| 220 */ | 220 */ |
| 221 List<String> readAsLinesSync([Encoding encoding]); | 221 List<String> readAsLinesSync([Encoding encoding]); |
| 222 | 222 |
| 223 /** | 223 /** |
| 224 * Get the name of the file. | 224 * Get the name of the file. |
| 225 */ | 225 */ |
| 226 String get name(); | 226 String get name; |
| 227 } | 227 } |
| 228 | 228 |
| 229 | 229 |
| 230 /** | 230 /** |
| 231 * [RandomAccessFile] provides random access to the data in a | 231 * [RandomAccessFile] provides random access to the data in a |
| 232 * file. [RandomAccessFile] objects are obtained by calling the | 232 * file. [RandomAccessFile] objects are obtained by calling the |
| 233 * [:open:] method on a [File] object. | 233 * [:open:] method on a [File] object. |
| 234 */ | 234 */ |
| 235 interface RandomAccessFile { | 235 interface RandomAccessFile { |
| 236 /** | 236 /** |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 Future<RandomAccessFile> flush(); | 363 Future<RandomAccessFile> flush(); |
| 364 | 364 |
| 365 /** | 365 /** |
| 366 * Synchronously flush the contents of the file to disk. | 366 * Synchronously flush the contents of the file to disk. |
| 367 */ | 367 */ |
| 368 void flushSync(); | 368 void flushSync(); |
| 369 | 369 |
| 370 /** | 370 /** |
| 371 * Get the name of the file. | 371 * Get the name of the file. |
| 372 */ | 372 */ |
| 373 String get name(); | 373 String get name; |
| 374 } | 374 } |
| 375 | 375 |
| 376 | 376 |
| 377 class FileIOException implements Exception { | 377 class FileIOException implements Exception { |
| 378 const FileIOException([String this.message = "", | 378 const FileIOException([String this.message = "", |
| 379 OSError this.osError = null]); | 379 OSError this.osError = null]); |
| 380 String toString() { | 380 String toString() { |
| 381 StringBuffer sb = new StringBuffer(); | 381 StringBuffer sb = new StringBuffer(); |
| 382 sb.add("FileIOException"); | 382 sb.add("FileIOException"); |
| 383 if (!message.isEmpty()) { | 383 if (!message.isEmpty()) { |
| 384 sb.add(": $message"); | 384 sb.add(": $message"); |
| 385 if (osError != null) { | 385 if (osError != null) { |
| 386 sb.add(" ($osError)"); | 386 sb.add(" ($osError)"); |
| 387 } | 387 } |
| 388 } else if (osError != null) { | 388 } else if (osError != null) { |
| 389 sb.add(": osError"); | 389 sb.add(": osError"); |
| 390 } | 390 } |
| 391 return sb.toString(); | 391 return sb.toString(); |
| 392 } | 392 } |
| 393 final String message; | 393 final String message; |
| 394 final OSError osError; | 394 final OSError osError; |
| 395 } | 395 } |
| OLD | NEW |