| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void writeString(String string); | 119 void writeString(String string); |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * Synchronously write a single string to the file. Returns the number | 122 * Synchronously write a single string to the file. Returns the number |
| 123 * of characters successfully written. | 123 * of characters successfully written. |
| 124 */ | 124 */ |
| 125 // TODO(ager): writeStringSync should take an encoding. | 125 // TODO(ager): writeStringSync should take an encoding. |
| 126 int writeStringSync(String string); | 126 int writeStringSync(String string); |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * Get the current position of the file. When the operation | 129 * Get the current byte position in the file. When the operation |
| 130 * completes the [positionHandler] is called with the position. | 130 * completes the [positionHandler] is called with the position. |
| 131 */ | 131 */ |
| 132 void position(); | 132 void position(); |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * Synchronously get the current position of the file. | 135 * Synchronously get the current byte position in the file. |
| 136 */ | 136 */ |
| 137 int positionSync(); | 137 int positionSync(); |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * Set the byte position in the file. When the operation completes |
| 141 * the [setPositionHandler] is called. |
| 142 */ |
| 143 void setPosition(int position); |
| 144 |
| 145 /** |
| 146 * Synchronously set the byte position in the file. |
| 147 */ |
| 148 void setPositionSync(int position); |
| 149 |
| 150 /** |
| 140 * Get the length of the file. When the operation completes the | 151 * Get the length of the file. When the operation completes the |
| 141 * [lengthHandler] is called with the length. | 152 * [lengthHandler] is called with the length. |
| 142 */ | 153 */ |
| 143 void length(); | 154 void length(); |
| 144 | 155 |
| 145 /** | 156 /** |
| 146 * Get the length of the file. When the operation completes the | 157 * Get the length of the file. When the operation completes the |
| 147 * [lengthHandler] is called with the length. | 158 * [lengthHandler] is called with the length. |
| 148 */ | 159 */ |
| 149 int lengthSync(); | 160 int lengthSync(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 201 |
| 191 // Event handlers. | 202 // Event handlers. |
| 192 void set existsHandler(void handler(bool exists)); | 203 void set existsHandler(void handler(bool exists)); |
| 193 void set createHandler(void handler()); | 204 void set createHandler(void handler()); |
| 194 void set openHandler(void handler()); | 205 void set openHandler(void handler()); |
| 195 void set closeHandler(void handler()); | 206 void set closeHandler(void handler()); |
| 196 void set readByteHandler(void handler(int byte)); | 207 void set readByteHandler(void handler(int byte)); |
| 197 void set readListHandler(void handler(int read)); | 208 void set readListHandler(void handler(int read)); |
| 198 void set noPendingWriteHandler(void handler()); | 209 void set noPendingWriteHandler(void handler()); |
| 199 void set positionHandler(void handler(int position)); | 210 void set positionHandler(void handler(int position)); |
| 211 void set setPositionHandler(void handler()); |
| 200 void set lengthHandler(void handler(int length)); | 212 void set lengthHandler(void handler(int length)); |
| 201 void set flushHandler(void handler()); | 213 void set flushHandler(void handler()); |
| 202 void set fullPathHandler(void handler(String path)); | 214 void set fullPathHandler(void handler(String path)); |
| 203 void set errorHandler(void handler(String error)); | 215 void set errorHandler(void handler(String error)); |
| 204 } | 216 } |
| 205 | 217 |
| 206 | 218 |
| 207 interface FileInputStream extends InputStream { | 219 interface FileInputStream extends InputStream { |
| 208 void close(); | 220 void close(); |
| 209 } | 221 } |
| 210 | 222 |
| 211 | 223 |
| 212 interface FileOutputStream extends OutputStream { | 224 interface FileOutputStream extends OutputStream { |
| 213 } | 225 } |
| 214 | 226 |
| 215 | 227 |
| 216 class FileIOException implements Exception { | 228 class FileIOException implements Exception { |
| 217 const FileIOException([String this.message = ""]); | 229 const FileIOException([String this.message = ""]); |
| 218 String toString() => "FileIOException: $message"; | 230 String toString() => "FileIOException: $message"; |
| 219 final String message; | 231 final String message; |
| 220 } | 232 } |
| OLD | NEW |