| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 interface File factory _File { | 5 interface File factory _File { |
| 6 /** | 6 /** |
| 7 * Create a File object. | 7 * Create a File object. |
| 8 */ | 8 */ |
| 9 File(String name); | 9 File(String name); |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 * called when the flush operation completes. | 153 * called when the flush operation completes. |
| 154 */ | 154 */ |
| 155 void flush(); | 155 void flush(); |
| 156 | 156 |
| 157 /** | 157 /** |
| 158 * Synchronously flush the contents of the file to disk. | 158 * Synchronously flush the contents of the file to disk. |
| 159 */ | 159 */ |
| 160 void flushSync(); | 160 void flushSync(); |
| 161 | 161 |
| 162 /** | 162 /** |
| 163 * Get the canonical full path corresponding to the file name. The |
| 164 * [fullPathHandler] is called when the fullPath operation |
| 165 * completes. |
| 166 */ |
| 167 String fullPath(); |
| 168 |
| 169 /** |
| 170 * Synchronously get the canonical full path corresponding to the file name. |
| 171 */ |
| 172 String fullPathSync(); |
| 173 |
| 174 /** |
| 163 * Create a new independent input stream for the file. The file | 175 * Create a new independent input stream for the file. The file |
| 164 * input stream must be closed when no longer used. | 176 * input stream must be closed when no longer used. |
| 165 */ | 177 */ |
| 166 FileInputStream openInputStream(); | 178 FileInputStream openInputStream(); |
| 167 | 179 |
| 168 /** | 180 /** |
| 169 * Creates a new independent output stream for the file. The file | 181 * Creates a new independent output stream for the file. The file |
| 170 * output stream must be closed when no longer used. | 182 * output stream must be closed when no longer used. |
| 171 */ | 183 */ |
| 172 FileOutputStream openOutputStream(); | 184 FileOutputStream openOutputStream(); |
| 173 | 185 |
| 174 /** | 186 /** |
| 175 * Get the name of the file. | 187 * Get the name of the file. |
| 176 */ | 188 */ |
| 177 String get name(); | 189 String get name(); |
| 178 | 190 |
| 179 // Event handlers. | 191 // Event handlers. |
| 180 void set existsHandler(void handler(bool exists)); | 192 void set existsHandler(void handler(bool exists)); |
| 181 void set createHandler(void handler()); | 193 void set createHandler(void handler()); |
| 182 void set openHandler(void handler()); | 194 void set openHandler(void handler()); |
| 183 void set closeHandler(void handler()); | 195 void set closeHandler(void handler()); |
| 184 void set readByteHandler(void handler(int byte)); | 196 void set readByteHandler(void handler(int byte)); |
| 185 void set readListHandler(void handler(int read)); | 197 void set readListHandler(void handler(int read)); |
| 186 void set noPendingWriteHandler(void handler()); | 198 void set noPendingWriteHandler(void handler()); |
| 187 void set positionHandler(void handler(int position)); | 199 void set positionHandler(void handler(int position)); |
| 188 void set lengthHandler(void handler(int length)); | 200 void set lengthHandler(void handler(int length)); |
| 189 void set flushHandler(void handler()); | 201 void set flushHandler(void handler()); |
| 202 void set fullPathHandler(void handler(String path)); |
| 190 void set errorHandler(void handler(String error)); | 203 void set errorHandler(void handler(String error)); |
| 191 } | 204 } |
| 192 | 205 |
| 193 | 206 |
| 194 interface FileInputStream extends InputStream { | 207 interface FileInputStream extends InputStream { |
| 195 void close(); | 208 void close(); |
| 196 } | 209 } |
| 197 | 210 |
| 198 | 211 |
| 199 interface FileOutputStream extends OutputStream { | 212 interface FileOutputStream extends OutputStream { |
| 200 } | 213 } |
| 201 | 214 |
| 202 | 215 |
| 203 class FileIOException implements Exception { | 216 class FileIOException implements Exception { |
| 204 const FileIOException([String this.message = ""]); | 217 const FileIOException([String this.message = ""]); |
| 205 String toString() => "FileIOException: $message"; | 218 String toString() => "FileIOException: $message"; |
| 206 final String message; | 219 final String message; |
| 207 } | 220 } |
| OLD | NEW |