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

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

Issue 1156993003: Fix argument processing for RandomAccessFile.writeFrom (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments Created 5 years, 7 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 | « no previous file | 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 /** 567 /**
568 * Reads into an existing List<int> from the file. If [start] is present, the 568 * Reads into an existing List<int> from the file. If [start] is present, the
569 * bytes will be filled into [buffer] from at index [start], otherwise index 569 * bytes will be filled into [buffer] from at index [start], otherwise index
570 * 0. If [end] is present, the [end] - [start] bytes will be read into 570 * 0. If [end] is present, the [end] - [start] bytes will be read into
571 * [buffer], otherwise up to [buffer.length]. If [end] == [start] nothing 571 * [buffer], otherwise up to [buffer.length]. If [end] == [start] nothing
572 * happends. 572 * happends.
573 * 573 *
574 * Returns a [:Future<int>:] that completes with the number of bytes read. 574 * Returns a [:Future<int>:] that completes with the number of bytes read.
575 */ 575 */
576 Future<int> readInto(List<int> buffer, [int start, int end]); 576 Future<int> readInto(List<int> buffer, [int start = 0, int end]);
577 577
578 /** 578 /**
579 * Synchronously reads into an existing List<int> from the file. If [start] is 579 * Synchronously reads into an existing List<int> from the file. If [start] is
580 * present, the bytes will be filled into [buffer] from at index [start], 580 * present, the bytes will be filled into [buffer] from at index [start],
581 * otherwise index 0. If [end] is present, the [end] - [start] bytes will be 581 * otherwise index 0. If [end] is present, the [end] - [start] bytes will be
582 * read into [buffer], otherwise up to [buffer.length]. If [end] == [start] 582 * read into [buffer], otherwise up to [buffer.length]. If [end] == [start]
583 * nothing happends. 583 * nothing happends.
584 * 584 *
585 * Throws a [FileSystemException] if the operation fails. 585 * Throws a [FileSystemException] if the operation fails.
586 */ 586 */
587 int readIntoSync(List<int> buffer, [int start, int end]); 587 int readIntoSync(List<int> buffer, [int start = 0, int end]);
588 588
589 /** 589 /**
590 * Writes a single byte to the file. Returns a 590 * Writes a single byte to the file. Returns a
591 * [:Future<RandomAccessFile>:] that completes with this 591 * [:Future<RandomAccessFile>:] that completes with this
592 * RandomAccessFile when the write completes. 592 * RandomAccessFile when the write completes.
593 */ 593 */
594 Future<RandomAccessFile> writeByte(int value); 594 Future<RandomAccessFile> writeByte(int value);
595 595
596 /** 596 /**
597 * Synchronously writes a single byte to the file. Returns the 597 * Synchronously writes a single byte to the file. Returns the
598 * number of bytes successfully written. 598 * number of bytes successfully written.
599 * 599 *
600 * Throws a [FileSystemException] if the operation fails. 600 * Throws a [FileSystemException] if the operation fails.
601 */ 601 */
602 int writeByteSync(int value); 602 int writeByteSync(int value);
603 603
604 /** 604 /**
605 * Writes from a [List<int>] to the file. It will read the buffer from index 605 * Writes from a [List<int>] to the file. It will read the buffer from index
606 * [start] to index [end]. If [start] is omitted, it'll start from index 0. 606 * [start] to index [end]. If [start] is omitted, it'll start from index 0.
607 * If [end] is omitted, it will write to end of [buffer]. 607 * If [end] is omitted, it will write to end of [buffer].
608 * 608 *
609 * Returns a [:Future<RandomAccessFile>:] that completes with this 609 * Returns a [:Future<RandomAccessFile>:] that completes with this
610 * [RandomAccessFile] when the write completes. 610 * [RandomAccessFile] when the write completes.
611 */ 611 */
612 Future<RandomAccessFile> writeFrom(List<int> buffer, [int start, int end]); 612 Future<RandomAccessFile> writeFrom(
613 List<int> buffer, [int start = 0, int end]);
613 614
614 /** 615 /**
615 * Synchronously writes from a [List<int>] to the file. It will read the 616 * Synchronously writes from a [List<int>] to the file. It will read the
616 * buffer from index [start] to index [end]. If [start] is omitted, it'll 617 * buffer from index [start] to index [end]. If [start] is omitted, it'll
617 * start from index 0. If [end] is omitted, it will write to the end of 618 * start from index 0. If [end] is omitted, it will write to the end of
618 * [buffer]. 619 * [buffer].
619 * 620 *
620 * Throws a [FileSystemException] if the operation fails. 621 * Throws a [FileSystemException] if the operation fails.
621 */ 622 */
622 void writeFromSync(List<int> buffer, [int start, int end]); 623 void writeFromSync(List<int> buffer, [int start = 0, int end]);
623 624
624 /** 625 /**
625 * Writes a string to the file using the given [Encoding]. Returns a 626 * Writes a string to the file using the given [Encoding]. Returns a
626 * [:Future<RandomAccessFile>:] that completes with this 627 * [:Future<RandomAccessFile>:] that completes with this
627 * RandomAccessFile when the write completes. 628 * RandomAccessFile when the write completes.
628 */ 629 */
629 Future<RandomAccessFile> writeString(String string, 630 Future<RandomAccessFile> writeString(String string,
630 {Encoding encoding: UTF8}); 631 {Encoding encoding: UTF8});
631 632
632 /** 633 /**
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 sb.write(": $osError"); 862 sb.write(": $osError");
862 if (path != null) { 863 if (path != null) {
863 sb.write(", path = '$path'"); 864 sb.write(", path = '$path'");
864 } 865 }
865 } else if (path != null) { 866 } else if (path != null) {
866 sb.write(": $path"); 867 sb.write(": $path");
867 } 868 }
868 return sb.toString(); 869 return sb.toString();
869 } 870 }
870 } 871 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698