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

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

Issue 11275042: Renaming IndexOutOfRangeException to RangeError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Regenerated html files. Created 8 years, 1 month 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 | « lib/html/src/_Lists.dart ('k') | lib/scalarlist/byte_arrays.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class _FileInputStream extends _BaseDataInputStream implements InputStream { 5 class _FileInputStream extends _BaseDataInputStream implements InputStream {
6 _FileInputStream(String name) 6 _FileInputStream(String name)
7 : _data = const [], 7 : _data = const [],
8 _position = 0, 8 _position = 0,
9 _filePosition = 0 { 9 _filePosition = 0 {
10 var file = new File(name); 10 var file = new File(name);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } else { 191 } else {
192 _write(data, 0, data.length); 192 _write(data, 0, data.length);
193 } 193 }
194 return false; 194 return false;
195 } 195 }
196 196
197 bool writeFrom(List<int> buffer, [int offset = 0, int len]) { 197 bool writeFrom(List<int> buffer, [int offset = 0, int len]) {
198 // A copy is required by the interface. 198 // A copy is required by the interface.
199 var length = buffer.length - offset; 199 var length = buffer.length - offset;
200 if (len != null) { 200 if (len != null) {
201 if (len > length) throw new IndexOutOfRangeException(len); 201 if (len > length) throw new RangeError.value(len);
202 length = len; 202 length = len;
203 } 203 }
204 var copy = new Uint8List(length); 204 var copy = new Uint8List(length);
205 copy.setRange(0, length, buffer, offset); 205 copy.setRange(0, length, buffer, offset);
206 return write(copy); 206 return write(copy);
207 } 207 }
208 208
209 209
210 void flush() { 210 void flush() {
211 if (_file == null) { 211 if (_file == null) {
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 "readList failed for file '$_name'"); 765 "readList failed for file '$_name'");
766 } 766 }
767 var read = response[1]; 767 var read = response[1];
768 var data = response[2]; 768 var data = response[2];
769 buffer.setRange(offset, read, data); 769 buffer.setRange(offset, read, data);
770 return read; 770 return read;
771 }); 771 });
772 } 772 }
773 773
774 static void _checkReadWriteListArguments(int length, int offset, int bytes) { 774 static void _checkReadWriteListArguments(int length, int offset, int bytes) {
775 if (offset < 0) throw new IndexOutOfRangeException(offset); 775 if (offset < 0) throw new RangeError.value(offset);
776 if (bytes < 0) throw new IndexOutOfRangeException(bytes); 776 if (bytes < 0) throw new RangeError.value(bytes);
777 if ((offset + bytes) > length) { 777 if ((offset + bytes) > length) {
778 throw new IndexOutOfRangeException(offset + bytes); 778 throw new RangeError.value(offset + bytes);
779 } 779 }
780 } 780 }
781 781
782 external static _readList(int id, List<int> buffer, int offset, int bytes); 782 external static _readList(int id, List<int> buffer, int offset, int bytes);
783 783
784 int readListSync(List<int> buffer, int offset, int bytes) { 784 int readListSync(List<int> buffer, int offset, int bytes) {
785 _checkNotClosed(); 785 _checkNotClosed();
786 if (buffer is !List || offset is !int || bytes is !int) { 786 if (buffer is !List || offset is !int || bytes is !int) {
787 throw new FileIOException( 787 throw new FileIOException(
788 "Invalid arguments to readList for file '$_name'"); 788 "Invalid arguments to readList for file '$_name'");
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 new FileIOException("File closed '$_name'")); 1080 new FileIOException("File closed '$_name'"));
1081 }); 1081 });
1082 return completer.future; 1082 return completer.future;
1083 } 1083 }
1084 1084
1085 final String _name; 1085 final String _name;
1086 int _id; 1086 int _id;
1087 1087
1088 SendPort _fileService; 1088 SendPort _fileService;
1089 } 1089 }
OLDNEW
« no previous file with comments | « lib/html/src/_Lists.dart ('k') | lib/scalarlist/byte_arrays.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698