| 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(0); | 10 static final READ = const FileMode(0); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 * Synchronously get the canonical full path corresponding to the file name. | 125 * Synchronously get the canonical full path corresponding to the file name. |
| 126 */ | 126 */ |
| 127 String fullPathSync(); | 127 String fullPathSync(); |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * Create a new independent input stream for the file. The file | 130 * Create a new independent input stream for the file. The file |
| 131 * input stream must be closed when no longer used to free up system | 131 * input stream must be closed when no longer used to free up system |
| 132 * resources. The [inputStreamHandler] is called with the result | 132 * resources. The [inputStreamHandler] is called with the result |
| 133 * when the openInputStream operation completes. | 133 * when the openInputStream operation completes. |
| 134 */ | 134 */ |
| 135 InputStream openInputStream(); | 135 void openInputStream(); |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Synchronously create a new independent input stream for the | 138 * Synchronously create a new independent input stream for the |
| 139 * file. The file input stream must be closed when no longer used to | 139 * file. The file input stream must be closed when no longer used to |
| 140 * free up system resources. | 140 * free up system resources. |
| 141 * | 141 * |
| 142 * Even though this call to open the input stream is synchronous the | 142 * Even though this call to open the input stream is synchronous the |
| 143 * input stream itself is asynchronous as is the case for all input | 143 * input stream itself is asynchronous as is the case for all input |
| 144 * streams. | 144 * streams. |
| 145 */ | 145 */ |
| 146 InputStream openInputStreamSync(); | 146 InputStream openInputStreamSync(); |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * Creates a new independent output stream for the file. The file | 149 * Creates a new independent output stream for the file. The file |
| 150 * output stream must be closed when no longer used to free up | 150 * output stream must be closed when no longer used to free up |
| 151 * system resources. | 151 * system resources. The [outputStreamHandler] is called with the result |
| 152 * when the openOutputStream operation completes. |
| 152 * | 153 * |
| 153 * An output stream can be opened in two modes: | 154 * An output stream can be opened in two modes: |
| 154 * | 155 * |
| 155 * FileMode.WRITE: create the stream and truncate the underlying | 156 * FileMode.WRITE: create the stream and truncate the underlying |
| 156 * file to length zero. | 157 * file to length zero. |
| 157 * | 158 * |
| 158 * FileMode.APPEND: create the stream and set the position to the end of | 159 * FileMode.APPEND: create the stream and set the position to the end of |
| 159 * the underlying file. | 160 * the underlying file. |
| 160 * | 161 * |
| 161 * By default the mode is FileMode.WRITE. | 162 * By default the mode is FileMode.WRITE. |
| 162 */ | 163 */ |
| 163 OutputStream openOutputStream([FileMode mode]); | 164 void openOutputStream([FileMode mode]); |
| 164 | 165 |
| 165 /** | 166 /** |
| 166 * Synchronously creates a new independent output stream for the | 167 * Synchronously creates a new independent output stream for the |
| 167 * file. The file output stream must be closed when no longer used | 168 * file. The file output stream must be closed when no longer used |
| 168 * to free up system resources. | 169 * to free up system resources. |
| 169 * | 170 * |
| 170 * See [openOutputStream] for information on the [:mode:] argument. | 171 * See [openOutputStream] for information on the [:mode:] argument. |
| 171 * | 172 * |
| 172 * Even though this call to open the output stream is synchronous | 173 * Even though this call to open the output stream is synchronous |
| 173 * the output stream itself is asynchronous as is the case for all | 174 * the output stream itself is asynchronous as is the case for all |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 */ | 505 */ |
| 505 void set errorHandler(void handler(String error)); | 506 void set errorHandler(void handler(String error)); |
| 506 } | 507 } |
| 507 | 508 |
| 508 | 509 |
| 509 class FileIOException implements Exception { | 510 class FileIOException implements Exception { |
| 510 const FileIOException([String this.message = ""]); | 511 const FileIOException([String this.message = ""]); |
| 511 String toString() => "FileIOException: $message"; | 512 String toString() => "FileIOException: $message"; |
| 512 final String message; | 513 final String message; |
| 513 } | 514 } |
| OLD | NEW |