Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: runtime/bin/file.dart

Issue 8679005: Add truncate operation to File API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
153 * the [setPositionHandler] is called. 153 * the [setPositionHandler] is called.
154 */ 154 */
155 void setPosition(int position); 155 void setPosition(int position);
156 156
157 /** 157 /**
158 * Synchronously set the byte position in the file. 158 * Synchronously set the byte position in the file.
159 */ 159 */
160 void setPositionSync(int position); 160 void setPositionSync(int position);
161 161
162 /** 162 /**
163 * Truncate (or extend) the file to [length] bytes. When the
164 * operation completes successfully the [truncateHandler] is called.
165 */
166 void truncate(int length);
167
168 /**
169 * Synchronously truncate (or extend) the file to [length] bytes.
170 */
171 void truncateSync(int length);
172
173 /**
163 * Get the length of the file. When the operation completes the 174 * Get the length of the file. When the operation completes the
164 * [lengthHandler] is called with the length. 175 * [lengthHandler] is called with the length.
165 */ 176 */
166 void length(); 177 void length();
167 178
168 /** 179 /**
169 * Get the length of the file. When the operation completes the 180 * Get the length of the file. When the operation completes the
170 * [lengthHandler] is called with the length. 181 * [lengthHandler] is called with the length.
171 */ 182 */
172 int lengthSync(); 183 int lengthSync();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 void set existsHandler(void handler(bool exists)); 226 void set existsHandler(void handler(bool exists));
216 void set createHandler(void handler()); 227 void set createHandler(void handler());
217 void set deleteHandler(void handler()); 228 void set deleteHandler(void handler());
218 void set openHandler(void handler()); 229 void set openHandler(void handler());
219 void set closeHandler(void handler()); 230 void set closeHandler(void handler());
220 void set readByteHandler(void handler(int byte)); 231 void set readByteHandler(void handler(int byte));
221 void set readListHandler(void handler(int read)); 232 void set readListHandler(void handler(int read));
222 void set noPendingWriteHandler(void handler()); 233 void set noPendingWriteHandler(void handler());
223 void set positionHandler(void handler(int position)); 234 void set positionHandler(void handler(int position));
224 void set setPositionHandler(void handler()); 235 void set setPositionHandler(void handler());
236 void set truncateHandler(void handler());
225 void set lengthHandler(void handler(int length)); 237 void set lengthHandler(void handler(int length));
226 void set flushHandler(void handler()); 238 void set flushHandler(void handler());
227 void set fullPathHandler(void handler(String path)); 239 void set fullPathHandler(void handler(String path));
228 void set errorHandler(void handler(String error)); 240 void set errorHandler(void handler(String error));
229 } 241 }
230 242
231 243
232 interface FileInputStream extends InputStream { 244 interface FileInputStream extends InputStream {
233 void close(); 245 void close();
234 } 246 }
235 247
236 248
237 interface FileOutputStream extends OutputStream { 249 interface FileOutputStream extends OutputStream {
238 } 250 }
239 251
240 252
241 class FileIOException implements Exception { 253 class FileIOException implements Exception {
242 const FileIOException([String msg = ""]) : message = msg; 254 const FileIOException([String msg = ""]) : message = msg;
243 String toString() => "FileIOException: $message"; 255 String toString() => "FileIOException: $message";
244 final String message; 256 final String message;
245 } 257 }
OLDNEW
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698