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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/common.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 * FileMode describes the modes in which a file can be opened. 8 * FileMode describes the modes in which a file can be opened.
9 */ 9 */
10 class FileMode { 10 class FileMode {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 /** 362 /**
363 * Synchronously reads a maximum of [bytes] bytes from a file and 363 * Synchronously reads a maximum of [bytes] bytes from a file and
364 * returns the result in a list of bytes. 364 * returns the result in a list of bytes.
365 * 365 *
366 * Throws a [FileIOException] if the operation fails. 366 * Throws a [FileIOException] if the operation fails.
367 */ 367 */
368 List<int> readSync(int bytes); 368 List<int> readSync(int bytes);
369 369
370 /** 370 /**
371 * Reads into an existing List<int> from the file. A maximum of [bytes] bytes 371 * Reads into an existing List<int> from the file. If [start] is present, the
372 * is read into [buffer], starting at position [offset] in the buffer. 372 * bytes will be filled into [buffer] from at index [start], otherwise index
373 * 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.
374 * otherwise index [buffer.length] - 1.
375 *
373 * Returns a [:Future<int>:] that completes with the number of bytes read. 376 * Returns a [:Future<int>:] that completes with the number of bytes read.
374 */ 377 */
375 Future<int> readList(List<int> buffer, int offset, int bytes); 378 Future<int> readInto(List<int> buffer, [int start, int end]);
376 379
377 /** 380 /**
378 * Synchronously reads from a file into [buffer]. A maximum of [bytes] bytes 381 * Synchronously reads into an existing List<int> from the file. If [start] is
379 * is read into [buffer], starting at position [offset] in the buffer. 382 * present, the bytes will be filled into [buffer] from at index [start],
380 * Returns the number of bytes read. 383 * otherwise index 0. If [end] is present, the [buffer] will be filled up to
384 * index [end], otherwise index [buffer.length] - 1.
381 * 385 *
382 * Throws a [FileIOException] if the operation fails. 386 * Throws a [FileIOException] if the operation fails.
383 */ 387 */
384 int readListSync(List<int> buffer, int offset, int bytes); 388 int readIntoSync(List<int> buffer, [int start, int end]);
385 389
386 /** 390 /**
387 * Writes a single byte to the file. Returns a 391 * Writes a single byte to the file. Returns a
388 * [:Future<RandomAccessFile>:] that completes with this 392 * [:Future<RandomAccessFile>:] that completes with this
389 * RandomAccessFile when the write completes. 393 * RandomAccessFile when the write completes.
390 */ 394 */
391 Future<RandomAccessFile> writeByte(int value); 395 Future<RandomAccessFile> writeByte(int value);
392 396
393 /** 397 /**
394 * Synchronously writes a single byte to the file. Returns the 398 * Synchronously writes a single byte to the file. Returns the
395 * number of bytes successfully written. 399 * number of bytes successfully written.
396 * 400 *
397 * Throws a [FileIOException] if the operation fails. 401 * Throws a [FileIOException] if the operation fails.
398 */ 402 */
399 int writeByteSync(int value); 403 int writeByteSync(int value);
400 404
401 /** 405 /**
402 * Writes from a List<int> to the file. [bytes] bytes are written from 406 * Writes from a [List<int>] to the file. It'll read the buffer from index
403 * [buffer], starting at position [offset] in the buffer. Returns a 407 * [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.
404 * [:Future<RandomAccessFile>:] that completes with this 408 * 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.
405 * RandomAccessFile when the write completes. 409 *
410 * Returns a [:Future<RandomAccessFile>:] that completes with this
411 * [RandomAccessFile] when the write completes.
406 */ 412 */
407 Future<RandomAccessFile> writeList(List<int> buffer, int offset, int bytes); 413 Future<RandomAccessFile> writeFrom(List<int> buffer, [int start, int end]);
408 414
409 /** 415 /**
410 * Synchronously writes a List<int> to the file. [bytes] bytes are 416 * 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.
411 * written from [buffer], starting at position [offset] in the 417 * written from [buffer], starting at position [offset] in the
412 * buffer. Returns the number of bytes successfully written. 418 * buffer. Returns the number of bytes successfully written.
413 * 419 *
414 * Throws a [FileIOException] if the operation fails. 420 * Throws a [FileIOException] if the operation fails.
415 */ 421 */
416 int writeListSync(List<int> buffer, int offset, int bytes); 422 void writeFromSync(List<int> buffer, [int start, int end]);
417 423
418 /** 424 /**
419 * Writes a string to the file using the given [Encoding]. Returns a 425 * Writes a string to the file using the given [Encoding]. Returns a
420 * [:Future<RandomAccessFile>:] that completes with this 426 * [:Future<RandomAccessFile>:] that completes with this
421 * RandomAccessFile when the write completes. 427 * RandomAccessFile when the write completes.
422 */ 428 */
423 Future<RandomAccessFile> writeString(String string, 429 Future<RandomAccessFile> writeString(String string,
424 {Encoding encoding: Encoding.UTF_8}); 430 {Encoding encoding: Encoding.UTF_8});
425 431
426 /** 432 /**
427 * Synchronously writes a single string to the file using the given 433 * Synchronously writes a single string to the file using the given
428 * [Encoding]. Returns the number of characters successfully 434 * [Encoding].
429 * written.
430 * 435 *
431 * Throws a [FileIOException] if the operation fails. 436 * Throws a [FileIOException] if the operation fails.
432 */ 437 */
433 int writeStringSync(String string, 438 void writeStringSync(String string,
434 {Encoding encoding: Encoding.UTF_8}); 439 {Encoding encoding: Encoding.UTF_8});
435 440
436 /** 441 /**
437 * Gets the current byte position in the file. Returns a 442 * Gets the current byte position in the file. Returns a
438 * [:Future<int>:] that completes with the position. 443 * [:Future<int>:] that completes with the position.
439 */ 444 */
440 Future<int> position(); 445 Future<int> position();
441 446
442 /** 447 /**
443 * Synchronously gets the current byte position in the file. 448 * Synchronously gets the current byte position in the file.
444 * 449 *
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 sb.write(" ($osError)"); 530 sb.write(" ($osError)");
526 } 531 }
527 } else if (osError != null) { 532 } else if (osError != null) {
528 sb.write(": osError"); 533 sb.write(": osError");
529 } 534 }
530 return sb.toString(); 535 return sb.toString();
531 } 536 }
532 final String message; 537 final String message;
533 final OSError osError; 538 final OSError osError;
534 } 539 }
OLDNEW
« 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