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

Side by Side Diff: sdk/lib/io/file.dart

Issue 2681683005: [dart:io] Adds functions to set file access and modification time (Closed)
Patch Set: Update changelog Created 3 years, 10 months 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
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | sdk/lib/io/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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * The modes in which a File can be opened. 8 * The modes in which a File can be opened.
9 */ 9 */
10 class FileMode { 10 class FileMode {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 factory File(String path) => new _File(path); 212 factory File(String path) => new _File(path);
213 213
214 /** 214 /**
215 * Create a File object from a URI. 215 * Create a File object from a URI.
216 * 216 *
217 * If [uri] cannot reference a file this throws [UnsupportedError]. 217 * If [uri] cannot reference a file this throws [UnsupportedError].
218 */ 218 */
219 factory File.fromUri(Uri uri) => new File(uri.toFilePath()); 219 factory File.fromUri(Uri uri) => new File(uri.toFilePath());
220 220
221 /** 221 /**
222 * Create the file. Returns a [:Future<File>:] that completes with 222 * Create the file. Returns a `Future<File>` that completes with
223 * the file when it has been created. 223 * the file when it has been created.
224 * 224 *
225 * If [recursive] is false, the default, the file is created only if 225 * If [recursive] is false, the default, the file is created only if
226 * all directories in the path exist. If [recursive] is true, all 226 * all directories in the path exist. If [recursive] is true, all
227 * non-existing path components are created. 227 * non-existing path components are created.
228 * 228 *
229 * Existing files are left untouched by [create]. Calling [create] on an 229 * Existing files are left untouched by [create]. Calling [create] on an
230 * existing file might fail if there are restrictive permissions on 230 * existing file might fail if there are restrictive permissions on
231 * the file. 231 * the file.
232 * 232 *
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 * Synchronously copy this file. Returns a [File] 281 * Synchronously copy this file. Returns a [File]
282 * instance for the copied file. 282 * instance for the copied file.
283 * 283 *
284 * If [newPath] identifies an existing file, that file is 284 * If [newPath] identifies an existing file, that file is
285 * replaced. If [newPath] identifies an existing directory the 285 * replaced. If [newPath] identifies an existing directory the
286 * operation fails and an exception is thrown. 286 * operation fails and an exception is thrown.
287 */ 287 */
288 File copySync(String newPath); 288 File copySync(String newPath);
289 289
290 /** 290 /**
291 * Get the length of the file. Returns a [:Future<int>:] that 291 * Get the length of the file. Returns a `Future<int>` that
292 * completes with the length in bytes. 292 * completes with the length in bytes.
293 */ 293 */
294 Future<int> length(); 294 Future<int> length();
295 295
296 /** 296 /**
297 * Synchronously get the length of the file. 297 * Synchronously get the length of the file.
298 * 298 *
299 * Throws a [FileSystemException] if the operation fails. 299 * Throws a [FileSystemException] if the operation fails.
300 */ 300 */
301 int lengthSync(); 301 int lengthSync();
302 302
303 /** 303 /**
304 * Returns a [File] instance whose path is the absolute path to [this]. 304 * Returns a [File] instance whose path is the absolute path to [this].
305 * 305 *
306 * The absolute path is computed by prefixing 306 * The absolute path is computed by prefixing
307 * a relative path with the current working directory, and returning 307 * a relative path with the current working directory, and returning
308 * an absolute path unchanged. 308 * an absolute path unchanged.
309 */ 309 */
310 File get absolute; 310 File get absolute;
311 311
312 /**
313 * Get the last-accessed time of the file.
314 *
315 * Returns the date and time when the file was last accessed, if the
316 * information is available.
317 *
318 * Throws a [FileSystemException] if the operation fails.
319 */
320 Future<DateTime> lastAccessed();
321
322 /**
323 * Get the last-accessed time of the file.
324 *
325 * Returns the date and time when the file was last accessed,
326 * if the information is available. Blocks until the information can be returned
327 * or it is determined that the information is not available.
328 *
329 * Throws a [FileSystemException] if the operation fails.
330 */
331 DateTime lastAccessedSync();
332
312 /** 333 /**
313 * Get the last-modified time of the file. Returns a 334 * Modifies the time the file was last accessed.
314 * [:Future<DateTime>:] that completes with a [DateTime] object for the 335 *
315 * modification date. 336 * Throws a [FilsSystemException] if the time cannot be set.
316 */ 337 */
338 Future setLastAccessed(DateTime time);
339
340 /**
341 * Synchronously modifies the time the file was last accessed.
342 *
343 * Throws a [FilsSystemException] if the time cannot be set.
344 */
345 void setLastAccessedSync(DateTime time);
346
347 /**
348 * Get the last-modified time of the file.
349 *
350 * Returns the date and time when the file was last modified, if the
351 * information is available.
352 *
353 * Throws a [FileSystemException] if the operation fails.
354 */
317 Future<DateTime> lastModified(); 355 Future<DateTime> lastModified();
318 356
319 /** 357 /**
320 * Get the last-modified time of the file. Throws an exception 358 * Get the last-modified time of the file.
321 * if the file does not exist. 359 *
322 * 360 * Returns the date and time when the file was last modified,
323 * Throws a [FileSystemException] if the operation fails. 361 * if the information is available. Blocks until the information can be returned
324 */ 362 * or it is determined that the information is not available.
363 *
364 * Throws a [FileSystemException] if the operation fails.
365 */
325 DateTime lastModifiedSync(); 366 DateTime lastModifiedSync();
326 367
327 /** 368 /**
369 * Modifies the time the file was last modified.
370 *
371 * Throws a [FilsSystemException] if the time cannot be set.
372 */
373 Future setLastModified(DateTime time);
374
375 /**
376 * Synchronously modifies the time the file was last modified.
377 *
378 * If the attributes cannot be set, throws a [FileSystemException].
379 */
380 void setLastModifiedSync(DateTime time);
381
382 /**
328 * Open the file for random access operations. Returns a 383 * Open the file for random access operations. Returns a
329 * [:Future<RandomAccessFile>:] that completes with the opened 384 * `Future<RandomAccessFile>` that completes with the opened
330 * random access file. [RandomAccessFile]s must be closed using the 385 * random access file. [RandomAccessFile]s must be closed using the
331 * [RandomAccessFile.close] method. 386 * [RandomAccessFile.close] method.
332 * 387 *
333 * Files can be opened in three modes: 388 * Files can be opened in three modes:
334 * 389 *
335 * [FileMode.READ]: open the file for reading. 390 * [FileMode.READ]: open the file for reading.
336 * 391 *
337 * [FileMode.WRITE]: open the file for both reading and writing and 392 * [FileMode.WRITE]: open the file for both reading and writing and
338 * truncate the file to length zero. If the file does not exist the 393 * truncate the file to length zero. If the file does not exist the
339 * file is created. 394 * file is created.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 * system resources. 431 * system resources.
377 * 432 *
378 * An [IOSink] for a file can be opened in two modes: 433 * An [IOSink] for a file can be opened in two modes:
379 * 434 *
380 * * [FileMode.WRITE]: truncates the file to length zero. 435 * * [FileMode.WRITE]: truncates the file to length zero.
381 * * [FileMode.APPEND]: sets the initial write position to the end 436 * * [FileMode.APPEND]: sets the initial write position to the end
382 * of the file. 437 * of the file.
383 * 438 *
384 * When writing strings through the returned [IOSink] the encoding 439 * When writing strings through the returned [IOSink] the encoding
385 * specified using [encoding] will be used. The returned [IOSink] 440 * specified using [encoding] will be used. The returned [IOSink]
386 * has an [:encoding:] property which can be changed after the 441 * has an `encoding` property which can be changed after the
387 * [IOSink] has been created. 442 * [IOSink] has been created.
388 */ 443 */
389 IOSink openWrite({FileMode mode: FileMode.WRITE, 444 IOSink openWrite({FileMode mode: FileMode.WRITE,
390 Encoding encoding: UTF8}); 445 Encoding encoding: UTF8});
391 446
392 /** 447 /**
393 * Read the entire file contents as a list of bytes. Returns a 448 * Read the entire file contents as a list of bytes. Returns a
394 * [:Future<List<int>>:] that completes with the list of bytes that 449 * `Future<List<int>>` that completes with the list of bytes that
395 * is the contents of the file. 450 * is the contents of the file.
396 */ 451 */
397 Future<List<int>> readAsBytes(); 452 Future<List<int>> readAsBytes();
398 453
399 /** 454 /**
400 * Synchronously read the entire file contents as a list of bytes. 455 * Synchronously read the entire file contents as a list of bytes.
401 * 456 *
402 * Throws a [FileSystemException] if the operation fails. 457 * Throws a [FileSystemException] if the operation fails.
403 */ 458 */
404 List<int> readAsBytesSync(); 459 List<int> readAsBytesSync();
405 460
406 /** 461 /**
407 * Read the entire file contents as a string using the given 462 * Read the entire file contents as a string using the given
408 * [Encoding]. 463 * [Encoding].
409 * 464 *
410 * Returns a [:Future<String>:] that completes with the string once 465 * Returns a `Future<String>` that completes with the string once
411 * the file contents has been read. 466 * the file contents has been read.
412 */ 467 */
413 Future<String> readAsString({Encoding encoding: UTF8}); 468 Future<String> readAsString({Encoding encoding: UTF8});
414 469
415 /** 470 /**
416 * Synchronously read the entire file contents as a string using the 471 * Synchronously read the entire file contents as a string using the
417 * given [Encoding]. 472 * given [Encoding].
418 * 473 *
419 * Throws a [FileSystemException] if the operation fails. 474 * Throws a [FileSystemException] if the operation fails.
420 */ 475 */
421 String readAsStringSync({Encoding encoding: UTF8}); 476 String readAsStringSync({Encoding encoding: UTF8});
422 477
423 /** 478 /**
424 * Read the entire file contents as lines of text using the given 479 * Read the entire file contents as lines of text using the given
425 * [Encoding]. 480 * [Encoding].
426 * 481 *
427 * Returns a [:Future<List<String>>:] that completes with the lines 482 * Returns a `Future<List<String>>` that completes with the lines
428 * once the file contents has been read. 483 * once the file contents has been read.
429 */ 484 */
430 Future<List<String>> readAsLines({Encoding encoding: UTF8}); 485 Future<List<String>> readAsLines({Encoding encoding: UTF8});
431 486
432 /** 487 /**
433 * Synchronously read the entire file contents as lines of text 488 * Synchronously read the entire file contents as lines of text
434 * using the given [Encoding]. 489 * using the given [Encoding].
435 * 490 *
436 * Throws a [FileSystemException] if the operation fails. 491 * Throws a [FileSystemException] if the operation fails.
437 */ 492 */
438 List<String> readAsLinesSync({Encoding encoding: UTF8}); 493 List<String> readAsLinesSync({Encoding encoding: UTF8});
439 494
440 /** 495 /**
441 * Write a list of bytes to a file. 496 * Write a list of bytes to a file.
442 * 497 *
443 * Opens the file, writes the list of bytes to it, and closes the file. 498 * Opens the file, writes the list of bytes to it, and closes the file.
444 * Returns a [:Future<File>:] that completes with this [File] object once 499 * Returns a `Future<File>` that completes with this [File] object once
445 * the entire operation has completed. 500 * the entire operation has completed.
446 * 501 *
447 * By default [writeAsBytes] creates the file for writing and truncates the 502 * By default [writeAsBytes] creates the file for writing and truncates the
448 * file if it already exists. In order to append the bytes to an existing 503 * file if it already exists. In order to append the bytes to an existing
449 * file, pass [FileMode.APPEND] as the optional mode parameter. 504 * file, pass [FileMode.APPEND] as the optional mode parameter.
450 * 505 *
451 * If the argument [flush] is set to `true`, the data written will be 506 * If the argument [flush] is set to `true`, the data written will be
452 * flushed to the file system before the returned future completes. 507 * flushed to the file system before the returned future completes.
453 */ 508 */
454 Future<File> writeAsBytes(List<int> bytes, 509 Future<File> writeAsBytes(List<int> bytes,
(...skipping 15 matching lines...) Expand all
470 * Throws a [FileSystemException] if the operation fails. 525 * Throws a [FileSystemException] if the operation fails.
471 */ 526 */
472 void writeAsBytesSync(List<int> bytes, 527 void writeAsBytesSync(List<int> bytes,
473 {FileMode mode: FileMode.WRITE, 528 {FileMode mode: FileMode.WRITE,
474 bool flush: false}); 529 bool flush: false});
475 530
476 /** 531 /**
477 * Write a string to a file. 532 * Write a string to a file.
478 * 533 *
479 * Opens the file, writes the string in the given encoding, and closes the 534 * Opens the file, writes the string in the given encoding, and closes the
480 * file. Returns a [:Future<File>:] that completes with this [File] object 535 * file. Returns a `Future<File>` that completes with this [File] object
481 * once the entire operation has completed. 536 * once the entire operation has completed.
482 * 537 *
483 * By default [writeAsString] creates the file for writing and truncates the 538 * By default [writeAsString] creates the file for writing and truncates the
484 * file if it already exists. In order to append the bytes to an existing 539 * file if it already exists. In order to append the bytes to an existing
485 * file, pass [FileMode.APPEND] as the optional mode parameter. 540 * file, pass [FileMode.APPEND] as the optional mode parameter.
486 * 541 *
487 * If the argument [flush] is set to `true`, the data written will be 542 * If the argument [flush] is set to `true`, the data written will be
488 * flushed to the file system before the returned future completes. 543 * flushed to the file system before the returned future completes.
489 * 544 *
490 */ 545 */
(...skipping 28 matching lines...) Expand all
519 */ 574 */
520 String get path; 575 String get path;
521 } 576 }
522 577
523 578
524 /** 579 /**
525 * `RandomAccessFile` provides random access to the data in a 580 * `RandomAccessFile` provides random access to the data in a
526 * file. 581 * file.
527 * 582 *
528 * `RandomAccessFile` objects are obtained by calling the 583 * `RandomAccessFile` objects are obtained by calling the
529 * [:open:] method on a [File] object. 584 * `open` method on a [File] object.
530 * 585 *
531 * A `RandomAccessFile` have both asynchronous and synchronous 586 * A `RandomAccessFile` have both asynchronous and synchronous
532 * methods. The asynchronous methods all return a `Future` 587 * methods. The asynchronous methods all return a `Future`
533 * whereas the synchronous methods will return the result directly, 588 * whereas the synchronous methods will return the result directly,
534 * and block the current isolate until the result is ready. 589 * and block the current isolate until the result is ready.
535 * 590 *
536 * At most one asynchronous method can be pending on a given `RandomAccessFile` 591 * At most one asynchronous method can be pending on a given `RandomAccessFile`
537 * instance at the time. If an asynchronous method is called when one is 592 * instance at the time. If an asynchronous method is called when one is
538 * already in progress a [FileSystemException] is thrown. 593 * already in progress a [FileSystemException] is thrown.
539 * 594 *
540 * If an asynchronous method is pending it is also not possible to call any 595 * If an asynchronous method is pending it is also not possible to call any
541 * synchronous methods. This will also throw a [FileSystemException]. 596 * synchronous methods. This will also throw a [FileSystemException].
542 */ 597 */
543 abstract class RandomAccessFile { 598 abstract class RandomAccessFile {
544 /** 599 /**
545 * Closes the file. Returns a [:Future<RandomAccessFile>:] that 600 * Closes the file. Returns a `Future<RandomAccessFile>` that
546 * completes with this RandomAccessFile when it has been closed. 601 * completes with this RandomAccessFile when it has been closed.
547 */ 602 */
548 Future<RandomAccessFile> close(); 603 Future<RandomAccessFile> close();
549 604
550 /** 605 /**
551 * Synchronously closes the file. 606 * Synchronously closes the file.
552 * 607 *
553 * Throws a [FileSystemException] if the operation fails. 608 * Throws a [FileSystemException] if the operation fails.
554 */ 609 */
555 void closeSync(); 610 void closeSync();
556 611
557 /** 612 /**
558 * Reads a byte from the file. Returns a [:Future<int>:] that 613 * Reads a byte from the file. Returns a `Future<int>` that
559 * completes with the byte, or with -1 if end-of-file has been reached. 614 * completes with the byte, or with -1 if end-of-file has been reached.
560 */ 615 */
561 Future<int> readByte(); 616 Future<int> readByte();
562 617
563 /** 618 /**
564 * Synchronously reads a single byte from the file. If end-of-file 619 * Synchronously reads a single byte from the file. If end-of-file
565 * has been reached -1 is returned. 620 * has been reached -1 is returned.
566 * 621 *
567 * Throws a [FileSystemException] if the operation fails. 622 * Throws a [FileSystemException] if the operation fails.
568 */ 623 */
(...skipping 12 matching lines...) Expand all
581 */ 636 */
582 List<int> readSync(int bytes); 637 List<int> readSync(int bytes);
583 638
584 /** 639 /**
585 * Reads into an existing [List<int>] from the file. If [start] is present, 640 * Reads into an existing [List<int>] from the file. If [start] is present,
586 * the bytes will be filled into [buffer] from at index [start], otherwise 641 * the bytes will be filled into [buffer] from at index [start], otherwise
587 * index 0. If [end] is present, the [end] - [start] bytes will be read into 642 * index 0. If [end] is present, the [end] - [start] bytes will be read into
588 * [buffer], otherwise up to [buffer.length]. If [end] == [start] nothing 643 * [buffer], otherwise up to [buffer.length]. If [end] == [start] nothing
589 * happens. 644 * happens.
590 * 645 *
591 * Returns a [:Future<int>:] that completes with the number of bytes read. 646 * Returns a `Future<int>` that completes with the number of bytes read.
592 */ 647 */
593 Future<int> readInto(List<int> buffer, [int start = 0, int end]); 648 Future<int> readInto(List<int> buffer, [int start = 0, int end]);
594 649
595 /** 650 /**
596 * Synchronously reads into an existing [List<int>] from the file. If [start] 651 * Synchronously reads into an existing [List<int>] from the file. If [start]
597 * is present, the bytes will be filled into [buffer] from at index [start], 652 * is present, the bytes will be filled into [buffer] from at index [start],
598 * otherwise index 0. If [end] is present, the [end] - [start] bytes will be 653 * otherwise index 0. If [end] is present, the [end] - [start] bytes will be
599 * read into [buffer], otherwise up to [buffer.length]. If [end] == [start] 654 * read into [buffer], otherwise up to [buffer.length]. If [end] == [start]
600 * nothing happens. 655 * nothing happens.
601 * 656 *
602 * Throws a [FileSystemException] if the operation fails. 657 * Throws a [FileSystemException] if the operation fails.
603 */ 658 */
604 int readIntoSync(List<int> buffer, [int start = 0, int end]); 659 int readIntoSync(List<int> buffer, [int start = 0, int end]);
605 660
606 /** 661 /**
607 * Writes a single byte to the file. Returns a 662 * Writes a single byte to the file. Returns a
608 * [:Future<RandomAccessFile>:] that completes with this 663 * `Future<RandomAccessFile>` that completes with this
609 * RandomAccessFile when the write completes. 664 * RandomAccessFile when the write completes.
610 */ 665 */
611 Future<RandomAccessFile> writeByte(int value); 666 Future<RandomAccessFile> writeByte(int value);
612 667
613 /** 668 /**
614 * Synchronously writes a single byte to the file. Returns the 669 * Synchronously writes a single byte to the file. Returns the
615 * number of bytes successfully written. 670 * number of bytes successfully written.
616 * 671 *
617 * Throws a [FileSystemException] if the operation fails. 672 * Throws a [FileSystemException] if the operation fails.
618 */ 673 */
619 int writeByteSync(int value); 674 int writeByteSync(int value);
620 675
621 /** 676 /**
622 * Writes from a [List<int>] to the file. It will read the buffer from index 677 * Writes from a [List<int>] to the file. It will read the buffer from index
623 * [start] to index [end]. If [start] is omitted, it'll start from index 0. 678 * [start] to index [end]. If [start] is omitted, it'll start from index 0.
624 * If [end] is omitted, it will write to end of [buffer]. 679 * If [end] is omitted, it will write to end of [buffer].
625 * 680 *
626 * Returns a [:Future<RandomAccessFile>:] that completes with this 681 * Returns a `Future<RandomAccessFile>` that completes with this
627 * [RandomAccessFile] when the write completes. 682 * [RandomAccessFile] when the write completes.
628 */ 683 */
629 Future<RandomAccessFile> writeFrom( 684 Future<RandomAccessFile> writeFrom(
630 List<int> buffer, [int start = 0, int end]); 685 List<int> buffer, [int start = 0, int end]);
631 686
632 /** 687 /**
633 * Synchronously writes from a [List<int>] to the file. It will read the 688 * Synchronously writes from a [List<int>] to the file. It will read the
634 * buffer from index [start] to index [end]. If [start] is omitted, it'll 689 * buffer from index [start] to index [end]. If [start] is omitted, it'll
635 * start from index 0. If [end] is omitted, it will write to the end of 690 * start from index 0. If [end] is omitted, it will write to the end of
636 * [buffer]. 691 * [buffer].
637 * 692 *
638 * Throws a [FileSystemException] if the operation fails. 693 * Throws a [FileSystemException] if the operation fails.
639 */ 694 */
640 void writeFromSync(List<int> buffer, [int start = 0, int end]); 695 void writeFromSync(List<int> buffer, [int start = 0, int end]);
641 696
642 /** 697 /**
643 * Writes a string to the file using the given [Encoding]. Returns a 698 * Writes a string to the file using the given [Encoding]. Returns a
644 * [:Future<RandomAccessFile>:] that completes with this 699 * `Future<RandomAccessFile>` that completes with this
645 * RandomAccessFile when the write completes. 700 * RandomAccessFile when the write completes.
646 */ 701 */
647 Future<RandomAccessFile> writeString(String string, 702 Future<RandomAccessFile> writeString(String string,
648 {Encoding encoding: UTF8}); 703 {Encoding encoding: UTF8});
649 704
650 /** 705 /**
651 * Synchronously writes a single string to the file using the given 706 * Synchronously writes a single string to the file using the given
652 * [Encoding]. 707 * [Encoding].
653 * 708 *
654 * Throws a [FileSystemException] if the operation fails. 709 * Throws a [FileSystemException] if the operation fails.
655 */ 710 */
656 void writeStringSync(String string, 711 void writeStringSync(String string,
657 {Encoding encoding: UTF8}); 712 {Encoding encoding: UTF8});
658 713
659 /** 714 /**
660 * Gets the current byte position in the file. Returns a 715 * Gets the current byte position in the file. Returns a
661 * [:Future<int>:] that completes with the position. 716 * `Future<int>` that completes with the position.
662 */ 717 */
663 Future<int> position(); 718 Future<int> position();
664 719
665 /** 720 /**
666 * Synchronously gets the current byte position in the file. 721 * Synchronously gets the current byte position in the file.
667 * 722 *
668 * Throws a [FileSystemException] if the operation fails. 723 * Throws a [FileSystemException] if the operation fails.
669 */ 724 */
670 int positionSync(); 725 int positionSync();
671 726
672 /** 727 /**
673 * Sets the byte position in the file. Returns a 728 * Sets the byte position in the file. Returns a
674 * [:Future<RandomAccessFile>:] that completes with this 729 * `Future<RandomAccessFile>` that completes with this
675 * RandomAccessFile when the position has been set. 730 * RandomAccessFile when the position has been set.
676 */ 731 */
677 Future<RandomAccessFile> setPosition(int position); 732 Future<RandomAccessFile> setPosition(int position);
678 733
679 /** 734 /**
680 * Synchronously sets the byte position in the file. 735 * Synchronously sets the byte position in the file.
681 * 736 *
682 * Throws a [FileSystemException] if the operation fails. 737 * Throws a [FileSystemException] if the operation fails.
683 */ 738 */
684 void setPositionSync(int position); 739 void setPositionSync(int position);
685 740
686 /** 741 /**
687 * Truncates (or extends) the file to [length] bytes. Returns a 742 * Truncates (or extends) the file to [length] bytes. Returns a
688 * [:Future<RandomAccessFile>:] that completes with this 743 * `Future<RandomAccessFile>` that completes with this
689 * RandomAccessFile when the truncation has been performed. 744 * RandomAccessFile when the truncation has been performed.
690 */ 745 */
691 Future<RandomAccessFile> truncate(int length); 746 Future<RandomAccessFile> truncate(int length);
692 747
693 /** 748 /**
694 * Synchronously truncates (or extends) the file to [length] bytes. 749 * Synchronously truncates (or extends) the file to [length] bytes.
695 * 750 *
696 * Throws a [FileSystemException] if the operation fails. 751 * Throws a [FileSystemException] if the operation fails.
697 */ 752 */
698 void truncateSync(int length); 753 void truncateSync(int length);
699 754
700 /** 755 /**
701 * Gets the length of the file. Returns a [:Future<int>:] that 756 * Gets the length of the file. Returns a `Future<int>` that
702 * completes with the length in bytes. 757 * completes with the length in bytes.
703 */ 758 */
704 Future<int> length(); 759 Future<int> length();
705 760
706 /** 761 /**
707 * Synchronously gets the length of the file. 762 * Synchronously gets the length of the file.
708 * 763 *
709 * Throws a [FileSystemException] if the operation fails. 764 * Throws a [FileSystemException] if the operation fails.
710 */ 765 */
711 int lengthSync(); 766 int lengthSync();
712 767
713 /** 768 /**
714 * Flushes the contents of the file to disk. Returns a 769 * Flushes the contents of the file to disk. Returns a
715 * [:Future<RandomAccessFile>:] that completes with this 770 * `Future<RandomAccessFile>` that completes with this
716 * RandomAccessFile when the flush operation completes. 771 * RandomAccessFile when the flush operation completes.
717 */ 772 */
718 Future<RandomAccessFile> flush(); 773 Future<RandomAccessFile> flush();
719 774
720 /** 775 /**
721 * Synchronously flushes the contents of the file to disk. 776 * Synchronously flushes the contents of the file to disk.
722 * 777 *
723 * Throws a [FileSystemException] if the operation fails. 778 * Throws a [FileSystemException] if the operation fails.
724 */ 779 */
725 void flushSync(); 780 void flushSync();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 sb.write(": $osError"); 945 sb.write(": $osError");
891 if (path != null) { 946 if (path != null) {
892 sb.write(", path = '$path'"); 947 sb.write(", path = '$path'");
893 } 948 }
894 } else if (path != null) { 949 } else if (path != null) {
895 sb.write(": $path"); 950 sb.write(": $path");
896 } 951 }
897 return sb.toString(); 952 return sb.toString();
898 } 953 }
899 } 954 }
OLDNEW
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698