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

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

Issue 13527004: Add comments to the synchronous file methods stating that they throw (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/file.dart ('k') | tests/standalone/io/file_error_test.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 // Read the file in blocks of size 64k. 7 // Read the file in blocks of size 64k.
8 const int _BLOCK_SIZE = 64 * 1024; 8 const int _BLOCK_SIZE = 64 * 1024;
9 9
10 10
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 throw _exceptionFromResponse(response, 691 throw _exceptionFromResponse(response,
692 "read failed for file '$_path'"); 692 "read failed for file '$_path'");
693 } 693 }
694 return response[1]; 694 return response[1];
695 }); 695 });
696 } 696 }
697 697
698 external static _read(int id, int bytes); 698 external static _read(int id, int bytes);
699 699
700 List<int> readSync(int bytes) { 700 List<int> readSync(int bytes) {
701 _checkNotClosed();
701 if (bytes is !int) { 702 if (bytes is !int) {
702 throw new FileIOException( 703 throw new FileIOException(
703 "Invalid arguments to readSync for file '$_path'"); 704 "Invalid arguments to readSync for file '$_path'");
704 } 705 }
705 return _read(_id, bytes); 706 var result = _read(_id, bytes);
707 if (result is OSError) {
708 throw new FileIOException("readSync failed for file '$_path'",
709 result);
710 }
711 return result;
706 } 712 }
707 713
708 Future<int> readList(List<int> buffer, int offset, int bytes) { 714 Future<int> readList(List<int> buffer, int offset, int bytes) {
709 _ensureFileService(); 715 _ensureFileService();
710 Completer<int> completer = new Completer<int>(); 716 Completer<int> completer = new Completer<int>();
711 if (buffer is !List || offset is !int || bytes is !int) { 717 if (buffer is !List || offset is !int || bytes is !int) {
712 // Complete asynchronously so the user has a chance to setup 718 // Complete asynchronously so the user has a chance to setup
713 // handlers without getting exceptions when registering the 719 // handlers without getting exceptions when registering the
714 // then handler. 720 // then handler.
715 Timer.run(() { 721 Timer.run(() {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 new FileIOException("File closed '$_path'")); 1050 new FileIOException("File closed '$_path'"));
1045 }); 1051 });
1046 return completer.future; 1052 return completer.future;
1047 } 1053 }
1048 1054
1049 final String _path; 1055 final String _path;
1050 int _id; 1056 int _id;
1051 1057
1052 SendPort _fileService; 1058 SendPort _fileService;
1053 } 1059 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file.dart ('k') | tests/standalone/io/file_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698