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

Unified Diff: sdk/lib/io/file.dart

Issue 14018007: Rename RandomAccessFile.readList and RandomAccessFile.writeList to RandomAccessFile.readInto and Ra… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix return type. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/common.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file.dart
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index b65ab8a46900e84c7ab32af403a42e64bdfe40c9..65e230842f4cd31a1783d6ec5fc4997294c0a496 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -368,20 +368,24 @@ abstract class RandomAccessFile {
List<int> readSync(int bytes);
/**
- * Reads into an existing List<int> from the file. A maximum of [bytes] bytes
- * is read into [buffer], starting at position [offset] in the buffer.
+ * Reads into an existing List<int> from the file. If [start] is present, the
+ * bytes will be filled into [buffer] from at index [start], otherwise index
+ * 0. If [end] is present, the [buffer] will be filled up to index [end],
Søren Gjesse 2013/04/15 13:48:44 Emphasize that buffer[end] is exclusive. That is e
Anders Johnsen 2013/04/15 15:37:05 Done.
+ * otherwise index [buffer.length] - 1.
+ *
* Returns a [:Future<int>:] that completes with the number of bytes read.
*/
- Future<int> readList(List<int> buffer, int offset, int bytes);
+ Future<int> readInto(List<int> buffer, [int start, int end]);
/**
- * Synchronously reads from a file into [buffer]. A maximum of [bytes] bytes
- * is read into [buffer], starting at position [offset] in the buffer.
- * Returns the number of bytes read.
+ * Synchronously reads into an existing List<int> from the file. If [start] is
+ * present, the bytes will be filled into [buffer] from at index [start],
+ * otherwise index 0. If [end] is present, the [buffer] will be filled up to
+ * index [end], otherwise index [buffer.length] - 1.
*
* Throws a [FileIOException] if the operation fails.
*/
- int readListSync(List<int> buffer, int offset, int bytes);
+ int readIntoSync(List<int> buffer, [int start, int end]);
/**
* Writes a single byte to the file. Returns a
@@ -399,12 +403,14 @@ abstract class RandomAccessFile {
int writeByteSync(int value);
/**
- * Writes from a List<int> to the file. [bytes] bytes are written from
- * [buffer], starting at position [offset] in the buffer. Returns a
- * [:Future<RandomAccessFile>:] that completes with this
- * RandomAccessFile when the write completes.
+ * Writes from a [List<int>] to the file. It'll read the buffer from index
+ * [start] to index [end]. If [start] is omitted, it'll start from index 0.
Søren Gjesse 2013/04/15 13:48:44 it'll -> it will
Anders Johnsen 2013/04/15 15:37:05 Done.
+ * If [end] is omitted, it'll write to index [buffer.length] - 1.
Søren Gjesse 2013/04/15 13:48:44 Ditto
Anders Johnsen 2013/04/15 15:37:05 Done.
+ *
+ * Returns a [:Future<RandomAccessFile>:] that completes with this
+ * [RandomAccessFile] when the write completes.
*/
- Future<RandomAccessFile> writeList(List<int> buffer, int offset, int bytes);
+ Future<RandomAccessFile> writeFrom(List<int> buffer, [int start, int end]);
/**
* Synchronously writes a List<int> to the file. [bytes] bytes are
Søren Gjesse 2013/04/15 13:48:44 Please update this dartdoc as well.
Anders Johnsen 2013/04/15 15:37:05 Done.
@@ -413,7 +419,7 @@ abstract class RandomAccessFile {
*
* Throws a [FileIOException] if the operation fails.
*/
- int writeListSync(List<int> buffer, int offset, int bytes);
+ void writeFromSync(List<int> buffer, [int start, int end]);
/**
* Writes a string to the file using the given [Encoding]. Returns a
@@ -425,13 +431,12 @@ abstract class RandomAccessFile {
/**
* Synchronously writes a single string to the file using the given
- * [Encoding]. Returns the number of characters successfully
- * written.
+ * [Encoding].
*
* Throws a [FileIOException] if the operation fails.
*/
- int writeStringSync(String string,
- {Encoding encoding: Encoding.UTF_8});
+ void writeStringSync(String string,
+ {Encoding encoding: Encoding.UTF_8});
/**
* Gets the current byte position in the file. Returns a
« no previous file with comments | « sdk/lib/io/common.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698