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

Side by Side Diff: lib/scalarlist/byte_arrays.dart

Issue 10989013: Change IllegalArgumentException to ArgumentError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated co19 test expectations. Created 8 years, 2 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
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 /** 5 /**
6 * A random-access sequence of bytes that also provides random access to 6 * A random-access sequence of bytes that also provides random access to
7 * the fixed-width integers and floating point numbers represented by 7 * the fixed-width integers and floating point numbers represented by
8 * those bytes. Byte arrays may be used to pack and unpack data from 8 * those bytes. Byte arrays may be used to pack and unpack data from
9 * external sources (such as networks or files systems), and to process 9 * external sources (such as networks or files systems), and to process
10 * large quantities of numerical data more efficiently than would be possible 10 * large quantities of numerical data more efficiently than would be possible
(...skipping 18 matching lines...) Expand all
29 * Returns a [ByteArray] _view_ of a portion of this byte array. 29 * Returns a [ByteArray] _view_ of a portion of this byte array.
30 * The returned byte array consists of [length] bytes starting 30 * The returned byte array consists of [length] bytes starting
31 * at position [start] in this byte array. The returned byte array 31 * at position [start] in this byte array. The returned byte array
32 * is backed by the same data as this byte array. In other words, 32 * is backed by the same data as this byte array. In other words,
33 * changes to the returned byte array are visible in this byte array 33 * changes to the returned byte array are visible in this byte array
34 * and vice-versa. 34 * and vice-versa.
35 * 35 *
36 * Throws [IndexOutOfRangeException] if [start] is negative, or if 36 * Throws [IndexOutOfRangeException] if [start] is negative, or if
37 * `start + length` is greater than the length of this byte array. 37 * `start + length` is greater than the length of this byte array.
38 * 38 *
39 * Throws [IllegalArgumentException] if [length] is negative. 39 * Throws [ArgumentError] if [length] is negative.
40 */ 40 */
41 ByteArray subByteArray([int start, int length]); 41 ByteArray subByteArray([int start, int length]);
42 42
43 /** 43 /**
44 * Returns the (possibly negative) integer represented by the byte at the 44 * Returns the (possibly negative) integer represented by the byte at the
45 * specified [byteOffset] in this byte array, in two's complement binary 45 * specified [byteOffset] in this byte array, in two's complement binary
46 * representation. The return value will be between -128 and 127, inclusive. 46 * representation. The return value will be between -128 and 127, inclusive.
47 * 47 *
48 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 48 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
49 * greater than or equal to the length of this byte array. 49 * greater than or equal to the length of this byte array.
50 */ 50 */
51 int getInt8(int byteOffset); 51 int getInt8(int byteOffset);
52 52
53 /** 53 /**
54 * Sets the byte at the specified [byteOffset] in this byte array to the 54 * Sets the byte at the specified [byteOffset] in this byte array to the
55 * two's complement binary representation of the specified [value], which 55 * two's complement binary representation of the specified [value], which
56 * must fit in a single byte. In other words, [value] must be between 56 * must fit in a single byte. In other words, [value] must be between
57 * -128 and 127, inclusive. 57 * -128 and 127, inclusive.
58 * 58 *
59 * Returns `byteOffset + 1`, which is the offset of the first byte in the 59 * Returns `byteOffset + 1`, which is the offset of the first byte in the
60 * array after the byte that was set by this call. This return value can 60 * array after the byte that was set by this call. This return value can
61 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 61 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
62 * 62 *
63 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 63 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
64 * greater than or equal to the length of this byte array. 64 * greater than or equal to the length of this byte array.
65 * 65 *
66 * Throws [IllegalArgumentException] if [value] is less than -128 or 66 * Throws [ArgumentError] if [value] is less than -128 or
67 * greater than 127. 67 * greater than 127.
68 */ 68 */
69 int setInt8(int byteOffset, int value); 69 int setInt8(int byteOffset, int value);
70 70
71 /** 71 /**
72 * Returns the positive integer represented by the byte at the specified 72 * Returns the positive integer represented by the byte at the specified
73 * [byteOffset] in this byte array, in unsigned binary form. The 73 * [byteOffset] in this byte array, in unsigned binary form. The
74 * return value will be between 0 and 255, inclusive. 74 * return value will be between 0 and 255, inclusive.
75 * 75 *
76 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 76 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
77 * greater than or equal to the length of this byte array. 77 * greater than or equal to the length of this byte array.
78 */ 78 */
79 int getUint8(int byteOffset); 79 int getUint8(int byteOffset);
80 80
81 /** 81 /**
82 * Sets the byte at the specified [byteOffset] in this byte array to the 82 * Sets the byte at the specified [byteOffset] in this byte array to the
83 * unsigned binary representation of the specified [value], which must fit 83 * unsigned binary representation of the specified [value], which must fit
84 * in a single byte. in other words, [value] must be between 0 and 255, 84 * in a single byte. in other words, [value] must be between 0 and 255,
85 * inclusive. 85 * inclusive.
86 * 86 *
87 * Returns `byteOffset + 1`, which is the offset of the first byte in the 87 * Returns `byteOffset + 1`, which is the offset of the first byte in the
88 * array after the byte that was set by this call. This return value can 88 * array after the byte that was set by this call. This return value can
89 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 89 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
90 * 90 *
91 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, 91 * Throws [IndexOutOfRangeException] if [byteOffset] is negative,
92 * or greater than or equal to the length of this byte array. 92 * or greater than or equal to the length of this byte array.
93 * 93 *
94 * Throws [IllegalArgumentException] if [value] is negative or 94 * Throws [ArgumentError] if [value] is negative or
95 * greater than 255. 95 * greater than 255.
96 */ 96 */
97 int setUint8(int byteOffset, int value); 97 int setUint8(int byteOffset, int value);
98 98
99 /** 99 /**
100 * Returns the (possibly negative) integer represented by the two bytes at 100 * Returns the (possibly negative) integer represented by the two bytes at
101 * the specified [byteOffset] in this byte array, in two's complement binary 101 * the specified [byteOffset] in this byte array, in two's complement binary
102 * form. The return value will be between 2<sup>15</sup> and 2<sup>15 - 1, 102 * form. The return value will be between 2<sup>15</sup> and 2<sup>15 - 1,
103 * inclusive. 103 * inclusive.
104 * 104 *
105 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 105 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
106 * `byteOffset + 2` is greater than the length of this byte array. 106 * `byteOffset + 2` is greater than the length of this byte array.
107 */ 107 */
108 int getInt16(int byteOffset); 108 int getInt16(int byteOffset);
109 109
110 /** 110 /**
111 * Sets the two bytes starting at the specified [byteOffset] in this 111 * Sets the two bytes starting at the specified [byteOffset] in this
112 * byte array to the two's complement binary representation of the specified 112 * byte array to the two's complement binary representation of the specified
113 * [value], which must fit in two bytes. In other words, [value] must lie 113 * [value], which must fit in two bytes. In other words, [value] must lie
114 * between 2<sup>15</sup> and 2<sup>15 - 1, inclusive. 114 * between 2<sup>15</sup> and 2<sup>15 - 1, inclusive.
115 * 115 *
116 * Returns `byteOffset + 2`, which is the offset of the first byte in the 116 * Returns `byteOffset + 2`, which is the offset of the first byte in the
117 * array after the last byte that was set by this call. This return value can 117 * array after the last byte that was set by this call. This return value can
118 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 118 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
119 * 119 *
120 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 120 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
121 * `byteOffset + 2` is greater than the length of this byte array. 121 * `byteOffset + 2` is greater than the length of this byte array.
122 * 122 *
123 * Throws [IllegalArgumentException] if [value] is less than 2<sup>15</sup> 123 * Throws [ArgumentError] if [value] is less than 2<sup>15</sup>
124 * or greater than 2<sup>15 - 1. 124 * or greater than 2<sup>15 - 1.
125 */ 125 */
126 int setInt16(int byteOffset, int value); 126 int setInt16(int byteOffset, int value);
127 127
128 /** 128 /**
129 * Returns the positive integer represented by the two bytes starting 129 * Returns the positive integer represented by the two bytes starting
130 * at the specified [byteOffset] in this byte array, in unsigned binary 130 * at the specified [byteOffset] in this byte array, in unsigned binary
131 * form. The return value will be between 0 and 2<sup>16 - 1, inclusive. 131 * form. The return value will be between 0 and 2<sup>16 - 1, inclusive.
132 * 132 *
133 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 133 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
134 * `byteOffset + 2` is greater than the length of this byte array. 134 * `byteOffset + 2` is greater than the length of this byte array.
135 */ 135 */
136 int getUint16(int byteOffset); 136 int getUint16(int byteOffset);
137 137
138 /** 138 /**
139 * Sets the two bytes starting at the specified [byteOffset] in this byte 139 * Sets the two bytes starting at the specified [byteOffset] in this byte
140 * array to the unsigned binary representation of the specified [value], 140 * array to the unsigned binary representation of the specified [value],
141 * which must fit in two bytes. in other words, [value] must be between 141 * which must fit in two bytes. in other words, [value] must be between
142 * 0 and 2<sup>16 - 1, inclusive. 142 * 0 and 2<sup>16 - 1, inclusive.
143 * 143 *
144 * Returns `byteOffset + 2`, which is the offset of the first byte in the 144 * Returns `byteOffset + 2`, which is the offset of the first byte in the
145 * array after the last byte that was set by this call. This return value can 145 * array after the last byte that was set by this call. This return value can
146 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 146 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
147 * 147 *
148 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 148 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
149 * `byteOffset + 2` is greater than the length of this byte array. 149 * `byteOffset + 2` is greater than the length of this byte array.
150 * 150 *
151 * Throws [IllegalArgumentException] if [value] is negative or 151 * Throws [ArgumentError] if [value] is negative or
152 * greater than 2<sup>16 - 1. 152 * greater than 2<sup>16 - 1.
153 */ 153 */
154 int setUint16(int byteOffset, int value); 154 int setUint16(int byteOffset, int value);
155 155
156 /** 156 /**
157 * Returns the (possibly negative) integer represented by the four bytes at 157 * Returns the (possibly negative) integer represented by the four bytes at
158 * the specified [byteOffset] in this byte array, in two's complement binary 158 * the specified [byteOffset] in this byte array, in two's complement binary
159 * form. The return value will be between 2<sup>31</sup> and 2<sup>31 - 1, 159 * form. The return value will be between 2<sup>31</sup> and 2<sup>31 - 1,
160 * inclusive. 160 * inclusive.
161 * 161 *
162 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 162 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
163 * `byteOffset + 4` is greater than the length of this byte array. 163 * `byteOffset + 4` is greater than the length of this byte array.
164 */ 164 */
165 int getInt32(int byteOffset); 165 int getInt32(int byteOffset);
166 166
167 /** 167 /**
168 * Sets the four bytes starting at the specified [byteOffset] in this 168 * Sets the four bytes starting at the specified [byteOffset] in this
169 * byte array to the two's complement binary representation of the specified 169 * byte array to the two's complement binary representation of the specified
170 * [value], which must fit in four bytes. In other words, [value] must lie 170 * [value], which must fit in four bytes. In other words, [value] must lie
171 * between 2<sup>31</sup> and 2<sup>31 - 1, inclusive. 171 * between 2<sup>31</sup> and 2<sup>31 - 1, inclusive.
172 * 172 *
173 * Returns `byteOffset + 4`, which is the offset of the first byte in the 173 * Returns `byteOffset + 4`, which is the offset of the first byte in the
174 * array after the last byte that was set by this call. This return value can 174 * array after the last byte that was set by this call. This return value can
175 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 175 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
176 * 176 *
177 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 177 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
178 * `byteOffset + 4` is greater than the length of this byte array. 178 * `byteOffset + 4` is greater than the length of this byte array.
179 * 179 *
180 * Throws [IllegalArgumentException] if [value] is less than 2<sup>31</sup> 180 * Throws [ArgumentError] if [value] is less than 2<sup>31</sup>
181 * or greater than 2<sup>31 - 1. 181 * or greater than 2<sup>31 - 1.
182 */ 182 */
183 int setInt32(int byteOffset, int value); 183 int setInt32(int byteOffset, int value);
184 184
185 /** 185 /**
186 * Returns the positive integer represented by the four bytes starting 186 * Returns the positive integer represented by the four bytes starting
187 * at the specified [byteOffset] in this byte array, in unsigned binary 187 * at the specified [byteOffset] in this byte array, in unsigned binary
188 * form. The return value will be between 0 and 2<sup>32 - 1, inclusive. 188 * form. The return value will be between 0 and 2<sup>32 - 1, inclusive.
189 * 189 *
190 */ 190 */
191 int getUint32(int byteOffset); 191 int getUint32(int byteOffset);
192 192
193 /** 193 /**
194 * Sets the four bytes starting at the specified [byteOffset] in this byte 194 * Sets the four bytes starting at the specified [byteOffset] in this byte
195 * array to the unsigned binary representation of the specified [value], 195 * array to the unsigned binary representation of the specified [value],
196 * which must fit in four bytes. in other words, [value] must be between 196 * which must fit in four bytes. in other words, [value] must be between
197 * 0 and 2<sup>32 - 1, inclusive. 197 * 0 and 2<sup>32 - 1, inclusive.
198 * 198 *
199 * Returns `byteOffset + 4`, which is the offset of the first byte in the 199 * Returns `byteOffset + 4`, which is the offset of the first byte in the
200 * array after the last byte that was set by this call. This return value can 200 * array after the last byte that was set by this call. This return value can
201 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 201 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
202 * 202 *
203 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 203 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
204 * `byteOffset + 4` is greater than the length of this byte array. 204 * `byteOffset + 4` is greater than the length of this byte array.
205 * 205 *
206 * Throws [IllegalArgumentException] if [value] is negative or 206 * Throws [ArgumentError] if [value] is negative or
207 * greater than 2<sup>32 - 1. 207 * greater than 2<sup>32 - 1.
208 */ 208 */
209 int setUint32(int byteOffset, int value); 209 int setUint32(int byteOffset, int value);
210 210
211 /** 211 /**
212 * Returns the (possibly negative) integer represented by the eight bytes at 212 * Returns the (possibly negative) integer represented by the eight bytes at
213 * the specified [byteOffset] in this byte array, in two's complement binary 213 * the specified [byteOffset] in this byte array, in two's complement binary
214 * form. The return value will be between 2<sup>63</sup> and 2<sup>63 - 1, 214 * form. The return value will be between 2<sup>63</sup> and 2<sup>63 - 1,
215 * inclusive. 215 * inclusive.
216 * 216 *
217 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 217 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
218 * `byteOffset + 8` is greater than the length of this byte array. 218 * `byteOffset + 8` is greater than the length of this byte array.
219 */ 219 */
220 int getInt64(int byteOffset); 220 int getInt64(int byteOffset);
221 221
222 /** 222 /**
223 * Sets the eight bytes starting at the specified [byteOffset] in this 223 * Sets the eight bytes starting at the specified [byteOffset] in this
224 * byte array to the two's complement binary representation of the specified 224 * byte array to the two's complement binary representation of the specified
225 * [value], which must fit in eight bytes. In other words, [value] must lie 225 * [value], which must fit in eight bytes. In other words, [value] must lie
226 * between 2<sup>63</sup> and 2<sup>63 - 1, inclusive. 226 * between 2<sup>63</sup> and 2<sup>63 - 1, inclusive.
227 * 227 *
228 * Returns `byteOffset + 8`, which is the offset of the first byte in the 228 * Returns `byteOffset + 8`, which is the offset of the first byte in the
229 * array after the last byte that was set by this call. This return value can 229 * array after the last byte that was set by this call. This return value can
230 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 230 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
231 * 231 *
232 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 232 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
233 * `byteOffset + 8` is greater than the length of this byte array. 233 * `byteOffset + 8` is greater than the length of this byte array.
234 * 234 *
235 * Throws [IllegalArgumentException] if [value] is less than 2<sup>63</sup> 235 * Throws [ArgumentError] if [value] is less than 2<sup>63</sup>
236 * or greater than 2<sup>63 - 1. 236 * or greater than 2<sup>63 - 1.
237 */ 237 */
238 int setInt64(int byteOffset, int value); 238 int setInt64(int byteOffset, int value);
239 239
240 /** 240 /**
241 * Returns the positive integer represented by the eight bytes starting 241 * Returns the positive integer represented by the eight bytes starting
242 * at the specified [byteOffset] in this byte array, in unsigned binary 242 * at the specified [byteOffset] in this byte array, in unsigned binary
243 * form. The return value will be between 0 and 2<sup>64 - 1, inclusive. 243 * form. The return value will be between 0 and 2<sup>64 - 1, inclusive.
244 * 244 *
245 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 245 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
246 * `byteOffset + 8` is greater than the length of this byte array. 246 * `byteOffset + 8` is greater than the length of this byte array.
247 */ 247 */
248 int getUint64(int byteOffset); 248 int getUint64(int byteOffset);
249 249
250 /** 250 /**
251 * Sets the eight bytes starting at the specified [byteOffset] in this byte 251 * Sets the eight bytes starting at the specified [byteOffset] in this byte
252 * array to the unsigned binary representation of the specified [value], 252 * array to the unsigned binary representation of the specified [value],
253 * which must fit in eight bytes. in other words, [value] must be between 253 * which must fit in eight bytes. in other words, [value] must be between
254 * 0 and 2<sup>64 - 1, inclusive. 254 * 0 and 2<sup>64 - 1, inclusive.
255 * 255 *
256 * Returns `byteOffset + 8`, which is the offset of the first byte in the 256 * Returns `byteOffset + 8`, which is the offset of the first byte in the
257 * array after the last byte that was set by this call. This return value can 257 * array after the last byte that was set by this call. This return value can
258 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call. 258 * be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
259 * 259 *
260 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 260 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
261 * `byteOffset + 8` is greater than the length of this byte array. 261 * `byteOffset + 8` is greater than the length of this byte array.
262 * 262 *
263 * Throws [IllegalArgumentException] if [value] is negative or 263 * Throws [ArgumentError] if [value] is negative or
264 * greater than 2<sup>64 - 1. 264 * greater than 2<sup>64 - 1.
265 */ 265 */
266 int setUint64(int byteOffset, int value); 266 int setUint64(int byteOffset, int value);
267 267
268 /** 268 /**
269 * Returns the floating point number represented by the four bytes at 269 * Returns the floating point number represented by the four bytes at
270 * the specified [byteOffset] in this byte array, in IEEE 754 270 * the specified [byteOffset] in this byte array, in IEEE 754
271 * single-precision binary floating-point format (binary32). 271 * single-precision binary floating-point format (binary32).
272 * 272 *
273 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or 273 * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 external Int16List(int length); 409 external Int16List(int length);
410 410
411 /** 411 /**
412 * Creates an [Int16List] _view_ of the specified region in the specified 412 * Creates an [Int16List] _view_ of the specified region in the specified
413 * byte [array]. Changes in the [Int16List] will be visible in the byte 413 * byte [array]. Changes in the [Int16List] will be visible in the byte
414 * array and vice versa. If the [start] index of the region is not specified, 414 * array and vice versa. If the [start] index of the region is not specified,
415 * it defaults to zero (the first byte in the byte array). If the length is 415 * it defaults to zero (the first byte in the byte array). If the length is
416 * not specified, it defaults to null, which indicates that the view extends 416 * not specified, it defaults to null, which indicates that the view extends
417 * to the end of the byte array. 417 * to the end of the byte array.
418 * 418 *
419 * Throws [IllegalArgumentException] if the length of the specified region 419 * Throws [ArgumentError] if the length of the specified region
420 * is not divisible by 2 (the size of an "int16" in bytes), or if the 420 * is not divisible by 2 (the size of an "int16" in bytes), or if the
421 * [start] of the region is not divisible by 2. If, however, [array] 421 * [start] of the region is not divisible by 2. If, however, [array]
422 * is a view of another byte array, this constructor will throw 422 * is a view of another byte array, this constructor will throw
423 * [IllegalArgumentException] if the implicit starting position in the 423 * [ArgumentError] if the implicit starting position in the
424 * "ultimately backing" byte array is not divisible by 2. In plain terms, 424 * "ultimately backing" byte array is not divisible by 2. In plain terms,
425 * this constructor throws [IllegalArgumentException] if the specified 425 * this constructor throws [ArgumentError] if the specified
426 * region does not contain an integral number of "int16s," or if it 426 * region does not contain an integral number of "int16s," or if it
427 * is not "int16-aligned." 427 * is not "int16-aligned."
428 */ 428 */
429 external Int16List.view(ByteArray array, [int start, int length]); 429 external Int16List.view(ByteArray array, [int start, int length]);
430 } 430 }
431 431
432 432
433 /** 433 /**
434 * A fixed-length list of 16-bit unsigned integers that is viewable as a 434 * A fixed-length list of 16-bit unsigned integers that is viewable as a
435 * [ByteArray]. For long lists, this implementation will be considerably 435 * [ByteArray]. For long lists, this implementation will be considerably
436 * more space- and time-efficient than the default [List] implementation. 436 * more space- and time-efficient than the default [List] implementation.
437 */ 437 */
438 class Uint16List implements List<int>, ByteArrayViewable { 438 class Uint16List implements List<int>, ByteArrayViewable {
439 /** 439 /**
440 * Creates a [Uint16List] of the specified length (in elements), all 440 * Creates a [Uint16List] of the specified length (in elements), all
441 * of whose elements are initially zero. 441 * of whose elements are initially zero.
442 */ 442 */
443 external Uint16List(int length); 443 external Uint16List(int length);
444 444
445 /** 445 /**
446 * Creates a [Uint16List] _view_ of the specified region in 446 * Creates a [Uint16List] _view_ of the specified region in
447 * the specified byte [array]. Changes in the [Uint16List] will be 447 * the specified byte [array]. Changes in the [Uint16List] will be
448 * visible in the byte array and vice versa. If the [start] index of the 448 * visible in the byte array and vice versa. If the [start] index of the
449 * region is not specified, it defaults to zero (the first byte in the byte 449 * region is not specified, it defaults to zero (the first byte in the byte
450 * array). If the length is not specified, it defaults to null, which 450 * array). If the length is not specified, it defaults to null, which
451 * indicates that the view extends to the end of the byte array. 451 * indicates that the view extends to the end of the byte array.
452 * 452 *
453 * Throws [IllegalArgumentException] if the length of the specified region 453 * Throws [ArgumentError] if the length of the specified region
454 * is not divisible by 2 (the size of a "uint16" in bytes), or if the 454 * is not divisible by 2 (the size of a "uint16" in bytes), or if the
455 * [start] of the region is not divisible by 2. If, however, [array] 455 * [start] of the region is not divisible by 2. If, however, [array]
456 * is a view of another byte array, this constructor will throw 456 * is a view of another byte array, this constructor will throw
457 * [IllegalArgumentException] if the implicit starting position in the 457 * [ArgumentError] if the implicit starting position in the
458 * "ultimately backing" byte array is not divisible by 2. In plain terms, 458 * "ultimately backing" byte array is not divisible by 2. In plain terms,
459 * this constructor throws [IllegalArgumentException] if the specified 459 * this constructor throws [ArgumentError] if the specified
460 * region does not contain an integral number of "uint16s," or if it 460 * region does not contain an integral number of "uint16s," or if it
461 * is not "uint16-aligned." 461 * is not "uint16-aligned."
462 */ 462 */
463 external Uint16List.view(ByteArray array, [int start, int length]); 463 external Uint16List.view(ByteArray array, [int start, int length]);
464 } 464 }
465 465
466 466
467 /** 467 /**
468 * A fixed-length list of 32-bit signed integers that is viewable as a 468 * A fixed-length list of 32-bit signed integers that is viewable as a
469 * [ByteArray]. For long lists, this implementation will be considerably 469 * [ByteArray]. For long lists, this implementation will be considerably
470 * more space- and time-efficient than the default [List] implementation. 470 * more space- and time-efficient than the default [List] implementation.
471 */ 471 */
472 class Int32List implements List<int>, ByteArrayViewable { 472 class Int32List implements List<int>, ByteArrayViewable {
473 /** 473 /**
474 * Creates an [Int32List] of the specified length (in elements), all of 474 * Creates an [Int32List] of the specified length (in elements), all of
475 * whose elements are initially zero. 475 * whose elements are initially zero.
476 */ 476 */
477 external Int32List(int length); 477 external Int32List(int length);
478 478
479 /** 479 /**
480 * Creates an [Int32List] _view_ of the specified region in the specified 480 * Creates an [Int32List] _view_ of the specified region in the specified
481 * byte [array]. Changes in the [Int32List] will be visible in the byte 481 * byte [array]. Changes in the [Int32List] will be visible in the byte
482 * array and vice versa. If the [start] index of the region is not specified, 482 * array and vice versa. If the [start] index of the region is not specified,
483 * it defaults to zero (the first byte in the byte array). If the length is 483 * it defaults to zero (the first byte in the byte array). If the length is
484 * not specified, it defaults to null, which indicates that the view extends 484 * not specified, it defaults to null, which indicates that the view extends
485 * to the end of the byte array. 485 * to the end of the byte array.
486 * 486 *
487 * Throws [IllegalArgumentException] if the length of the specified region 487 * Throws [ArgumentError] if the length of the specified region
488 * is not divisible by 4 (the size of an "int32" in bytes), or if the 488 * is not divisible by 4 (the size of an "int32" in bytes), or if the
489 * [start] of the region is not divisible by 4. If, however, [array] 489 * [start] of the region is not divisible by 4. If, however, [array]
490 * is a view of another byte array, this constructor will throw 490 * is a view of another byte array, this constructor will throw
491 * [IllegalArgumentException] if the implicit starting position in the 491 * [ArgumentError] if the implicit starting position in the
492 * "ultimately backing" byte array is not divisible by 4. In plain terms, 492 * "ultimately backing" byte array is not divisible by 4. In plain terms,
493 * this constructor throws [IllegalArgumentException] if the specified 493 * this constructor throws [ArgumentError] if the specified
494 * region does not contain an integral number of "int32s," or if it 494 * region does not contain an integral number of "int32s," or if it
495 * is not "int32-aligned." 495 * is not "int32-aligned."
496 */ 496 */
497 external Int32List.view(ByteArray array, [int start, int length]); 497 external Int32List.view(ByteArray array, [int start, int length]);
498 } 498 }
499 499
500 500
501 /** 501 /**
502 * A fixed-length list of 32-bit unsigned integers that is viewable as a 502 * A fixed-length list of 32-bit unsigned integers that is viewable as a
503 * [ByteArray]. For long lists, this implementation will be considerably 503 * [ByteArray]. For long lists, this implementation will be considerably
504 * more space- and time-efficient than the default [List] implementation. 504 * more space- and time-efficient than the default [List] implementation.
505 */ 505 */
506 class Uint32List implements List<int>, ByteArrayViewable { 506 class Uint32List implements List<int>, ByteArrayViewable {
507 /** 507 /**
508 * Creates a [Uint32List] of the specified length (in elements), all 508 * Creates a [Uint32List] of the specified length (in elements), all
509 * of whose elements are initially zero. 509 * of whose elements are initially zero.
510 */ 510 */
511 external Uint32List(int length); 511 external Uint32List(int length);
512 512
513 /** 513 /**
514 * Creates a [Uint32List] _view_ of the specified region in 514 * Creates a [Uint32List] _view_ of the specified region in
515 * the specified byte [array]. Changes in the [Uint32] will be 515 * the specified byte [array]. Changes in the [Uint32] will be
516 * visible in the byte array and vice versa. If the [start] index of the 516 * visible in the byte array and vice versa. If the [start] index of the
517 * region is not specified, it defaults to zero (the first byte in the byte 517 * region is not specified, it defaults to zero (the first byte in the byte
518 * array). If the length is not specified, it defaults to null, which 518 * array). If the length is not specified, it defaults to null, which
519 * indicates that the view extends to the end of the byte array. 519 * indicates that the view extends to the end of the byte array.
520 * 520 *
521 * Throws [IllegalArgumentException] if the length of the specified region 521 * Throws [ArgumentError] if the length of the specified region
522 * is not divisible by 4 (the size of a "uint32" in bytes), or if the 522 * is not divisible by 4 (the size of a "uint32" in bytes), or if the
523 * [start] of the region is not divisible by 4. If, however, [array] 523 * [start] of the region is not divisible by 4. If, however, [array]
524 * is a view of another byte array, this constructor will throw 524 * is a view of another byte array, this constructor will throw
525 * [IllegalArgumentException] if the implicit starting position in the 525 * [ArgumentError] if the implicit starting position in the
526 * "ultimately backing" byte array is not divisible by 4. In plain terms, 526 * "ultimately backing" byte array is not divisible by 4. In plain terms,
527 * this constructor throws [IllegalArgumentException] if the specified 527 * this constructor throws [ArgumentError] if the specified
528 * region does not contain an integral number of "uint32s," or if it 528 * region does not contain an integral number of "uint32s," or if it
529 * is not "uint32-aligned." 529 * is not "uint32-aligned."
530 */ 530 */
531 external Uint32List.view(ByteArray array, [int start, int length]); 531 external Uint32List.view(ByteArray array, [int start, int length]);
532 } 532 }
533 533
534 534
535 /** 535 /**
536 * A fixed-length list of 64-bit signed integers that is viewable as a 536 * A fixed-length list of 64-bit signed integers that is viewable as a
537 * [ByteArray]. For long lists, this implementation will be considerably 537 * [ByteArray]. For long lists, this implementation will be considerably
538 * more space- and time-efficient than the default [List] implementation. 538 * more space- and time-efficient than the default [List] implementation.
539 */ 539 */
540 class Int64List implements List<int>, ByteArrayViewable { 540 class Int64List implements List<int>, ByteArrayViewable {
541 /** 541 /**
542 * Creates an [Int64List] of the specified length (in elements), all of 542 * Creates an [Int64List] of the specified length (in elements), all of
543 * whose elements are initially zero. 543 * whose elements are initially zero.
544 */ 544 */
545 external Int64List(int length); 545 external Int64List(int length);
546 546
547 /** 547 /**
548 * Creates an [Int64List] _view_ of the specified region in the specified 548 * Creates an [Int64List] _view_ of the specified region in the specified
549 * byte [array]. Changes in the [Int64List] will be visible in the byte 549 * byte [array]. Changes in the [Int64List] will be visible in the byte
550 * array and vice versa. If the [start] index of the region is not specified, 550 * array and vice versa. If the [start] index of the region is not specified,
551 * it defaults to zero (the first byte in the byte array). If the length is 551 * it defaults to zero (the first byte in the byte array). If the length is
552 * not specified, it defaults to null, which indicates that the view extends 552 * not specified, it defaults to null, which indicates that the view extends
553 * to the end of the byte array. 553 * to the end of the byte array.
554 * 554 *
555 * Throws [IllegalArgumentException] if the length of the specified region 555 * Throws [ArgumentError] if the length of the specified region
556 * is not divisible by 8 (the size of an "int64" in bytes), or if the 556 * is not divisible by 8 (the size of an "int64" in bytes), or if the
557 * [start] of the region is not divisible by 8. If, however, [array] 557 * [start] of the region is not divisible by 8. If, however, [array]
558 * is a view of another byte array, this constructor will throw 558 * is a view of another byte array, this constructor will throw
559 * [IllegalArgumentException] if the implicit starting position in the 559 * [ArgumentError] if the implicit starting position in the
560 * "ultimately backing" byte array is not divisible by 8. In plain terms, 560 * "ultimately backing" byte array is not divisible by 8. In plain terms,
561 * this constructor throws [IllegalArgumentException] if the specified 561 * this constructor throws [ArgumentError] if the specified
562 * region does not contain an integral number of "int64s," or if it 562 * region does not contain an integral number of "int64s," or if it
563 * is not "int64-aligned." 563 * is not "int64-aligned."
564 */ 564 */
565 external Int64List.view(ByteArray array, [int start, int length]); 565 external Int64List.view(ByteArray array, [int start, int length]);
566 } 566 }
567 567
568 568
569 /** 569 /**
570 * A fixed-length list of 64-bit unsigned integers that is viewable as a 570 * A fixed-length list of 64-bit unsigned integers that is viewable as a
571 * [ByteArray]. For long lists, this implementation will be considerably 571 * [ByteArray]. For long lists, this implementation will be considerably
572 * more space- and time-efficient than the default [List] implementation. 572 * more space- and time-efficient than the default [List] implementation.
573 */ 573 */
574 class Uint64List implements List<int>, ByteArrayViewable { 574 class Uint64List implements List<int>, ByteArrayViewable {
575 /** 575 /**
576 * Creates a [Uint64List] of the specified length (in elements), all 576 * Creates a [Uint64List] of the specified length (in elements), all
577 * of whose elements are initially zero. 577 * of whose elements are initially zero.
578 */ 578 */
579 external Uint64List(int length); 579 external Uint64List(int length);
580 580
581 /** 581 /**
582 * Creates an [Uint64List] _view_ of the specified region in 582 * Creates an [Uint64List] _view_ of the specified region in
583 * the specified byte [array]. Changes in the [Uint64List] will be 583 * the specified byte [array]. Changes in the [Uint64List] will be
584 * visible in the byte array and vice versa. If the [start] index of the 584 * visible in the byte array and vice versa. If the [start] index of the
585 * region is not specified, it defaults to zero (the first byte in the byte 585 * region is not specified, it defaults to zero (the first byte in the byte
586 * array). If the length is not specified, it defaults to null, which 586 * array). If the length is not specified, it defaults to null, which
587 * indicates that the view extends to the end of the byte array. 587 * indicates that the view extends to the end of the byte array.
588 * 588 *
589 * Throws [IllegalArgumentException] if the length of the specified region 589 * Throws [ArgumentError] if the length of the specified region
590 * is not divisible by 8 (the size of a "uint64" in bytes), or if the 590 * is not divisible by 8 (the size of a "uint64" in bytes), or if the
591 * [start] of the region is not divisible by 8. If, however, [array] 591 * [start] of the region is not divisible by 8. If, however, [array]
592 * is a view of another byte array, this constructor will throw 592 * is a view of another byte array, this constructor will throw
593 * [IllegalArgumentException] if the implicit starting position in the 593 * [ArgumentError] if the implicit starting position in the
594 * "ultimately backing" byte array is not divisible by 8. In plain terms, 594 * "ultimately backing" byte array is not divisible by 8. In plain terms,
595 * this constructor throws [IllegalArgumentException] if the specified 595 * this constructor throws [ArgumentError] if the specified
596 * region does not contain an integral number of "uint64s," or if it 596 * region does not contain an integral number of "uint64s," or if it
597 * is not "uint64-aligned." 597 * is not "uint64-aligned."
598 */ 598 */
599 external Uint64List.view(ByteArray array, [int start, int length]); 599 external Uint64List.view(ByteArray array, [int start, int length]);
600 } 600 }
601 601
602 602
603 /** 603 /**
604 * A fixed-length list of IEEE 754 single-precision binary floating-point 604 * A fixed-length list of IEEE 754 single-precision binary floating-point
605 * numbers that is viewable as a [ByteArray]. For long lists, this 605 * numbers that is viewable as a [ByteArray]. For long lists, this
606 * implementation will be considerably more space- and time-efficient than 606 * implementation will be considerably more space- and time-efficient than
607 * the default [List] implementation. 607 * the default [List] implementation.
608 */ 608 */
609 class Float32List implements List<double>, ByteArrayViewable { 609 class Float32List implements List<double>, ByteArrayViewable {
610 /** 610 /**
611 * Creates a [Float32List] of the specified length (in elements), all of 611 * Creates a [Float32List] of the specified length (in elements), all of
612 * whose elements are initially zero. 612 * whose elements are initially zero.
613 */ 613 */
614 external Float32List(int length); 614 external Float32List(int length);
615 615
616 /** 616 /**
617 * Creates a [Float32List] _view_ of the specified region in the specified 617 * Creates a [Float32List] _view_ of the specified region in the specified
618 * byte [array]. Changes in the [Float32List] will be visible in the byte 618 * byte [array]. Changes in the [Float32List] will be visible in the byte
619 * array and vice versa. If the [start] index of the region is not specified, 619 * array and vice versa. If the [start] index of the region is not specified,
620 * it defaults to zero (the first byte in the byte array). If the length is 620 * it defaults to zero (the first byte in the byte array). If the length is
621 * not specified, it defaults to null, which indicates that the view extends 621 * not specified, it defaults to null, which indicates that the view extends
622 * to the end of the byte array. 622 * to the end of the byte array.
623 * 623 *
624 * Throws [IllegalArgumentException] if the length of the specified region 624 * Throws [ArgumentError] if the length of the specified region
625 * is not divisible by 4 (the size of a "float32" in bytes), or if the 625 * is not divisible by 4 (the size of a "float32" in bytes), or if the
626 * [start] of the region is not divisible by 4. If, however, [array] 626 * [start] of the region is not divisible by 4. If, however, [array]
627 * is a view of another byte array, this constructor will throw 627 * is a view of another byte array, this constructor will throw
628 * [IllegalArgumentException] if the implicit starting position in the 628 * [ArgumentError] if the implicit starting position in the
629 * "ultimately backing" byte array is not divisible by 4. In plain terms, 629 * "ultimately backing" byte array is not divisible by 4. In plain terms,
630 * this constructor throws [IllegalArgumentException] if the specified 630 * this constructor throws [ArgumentError] if the specified
631 * region does not contain an integral number of "float32s," or if it 631 * region does not contain an integral number of "float32s," or if it
632 * is not "float32-aligned." 632 * is not "float32-aligned."
633 */ 633 */
634 external Float32List.view(ByteArray array, [int start, int length]); 634 external Float32List.view(ByteArray array, [int start, int length]);
635 } 635 }
636 636
637 637
638 /** 638 /**
639 * A fixed-length list of IEEE 754 double-precision binary floating-point 639 * A fixed-length list of IEEE 754 double-precision binary floating-point
640 * numbers that is viewable as a [ByteArray]. For long lists, this 640 * numbers that is viewable as a [ByteArray]. For long lists, this
641 * implementation will be considerably more space- and time-efficient than 641 * implementation will be considerably more space- and time-efficient than
642 * the default [List] implementation. 642 * the default [List] implementation.
643 */ 643 */
644 class Float64List implements List<double>, ByteArrayViewable { 644 class Float64List implements List<double>, ByteArrayViewable {
645 /** 645 /**
646 * Creates a [Float64List] of the specified length (in elements), all of 646 * Creates a [Float64List] of the specified length (in elements), all of
647 * whose elements are initially zero. 647 * whose elements are initially zero.
648 */ 648 */
649 external Float64List(int length); 649 external Float64List(int length);
650 650
651 /** 651 /**
652 * Creates a [Float64List] _view_ of the specified region in the specified 652 * Creates a [Float64List] _view_ of the specified region in the specified
653 * byte [array]. Changes in the [Float64List] will be visible in the byte 653 * byte [array]. Changes in the [Float64List] will be visible in the byte
654 * array and vice versa. If the [start] index of the region is not specified, 654 * array and vice versa. If the [start] index of the region is not specified,
655 * it defaults to zero (the first byte in the byte array). If the length is 655 * it defaults to zero (the first byte in the byte array). If the length is
656 * not specified, it defaults to null, which indicates that the view extends 656 * not specified, it defaults to null, which indicates that the view extends
657 * to the end of the byte array. 657 * to the end of the byte array.
658 * 658 *
659 * Throws [IllegalArgumentException] if the length of the specified region 659 * Throws [ArgumentError] if the length of the specified region
660 * is not divisible by 8 (the size of a "float64" in bytes), or if the 660 * is not divisible by 8 (the size of a "float64" in bytes), or if the
661 * [start] of the region is not divisible by 8. If, however, [array] 661 * [start] of the region is not divisible by 8. If, however, [array]
662 * is a view of another byte array, this constructor will throw 662 * is a view of another byte array, this constructor will throw
663 * [IllegalArgumentException] if the implicit starting position in the 663 * [ArgumentError] if the implicit starting position in the
664 * "ultimately backing" byte array is not divisible by 8. In plain terms, 664 * "ultimately backing" byte array is not divisible by 8. In plain terms,
665 * this constructor throws [IllegalArgumentException] if the specified 665 * this constructor throws [ArgumentError] if the specified
666 * region does not contain an integral number of "float64s," or if it 666 * region does not contain an integral number of "float64s," or if it
667 * is not "float64-aligned." 667 * is not "float64-aligned."
668 */ 668 */
669 external Float64List.view(ByteArray array, [int start, int length]); 669 external Float64List.view(ByteArray array, [int start, int length]);
670 } 670 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698