| OLD | NEW |
| 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 interface ByteArray { | 5 interface ByteArray { |
| 6 int lengthInBytes(); | 6 int lengthInBytes(); |
| 7 | 7 |
| 8 ByteArray subByteArray([int start, int length]); | 8 ByteArray subByteArray([int start, int length]); |
| 9 | 9 |
| 10 int getInt8(int byteOffset); | 10 int getInt8(int byteOffset); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 void setFloat64(int byteOffset, double value); | 48 void setFloat64(int byteOffset, double value); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 interface ByteArrayViewable { | 52 interface ByteArrayViewable { |
| 53 int bytesPerElement(); | 53 int bytesPerElement(); |
| 54 | 54 |
| 55 int lengthInBytes(); | 55 int lengthInBytes(); |
| 56 | 56 |
| 57 ByteArray asByteArray([int offsetInBytes, int lengthInBytes]); | 57 ByteArray asByteArray([int start, int length]); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 interface Int8List extends List<int>, ByteArrayViewable | 61 interface Int8List extends List<int>, ByteArrayViewable |
| 62 default _Int8ArrayFactory { | 62 default _Int8ArrayFactory { |
| 63 Int8List(int length); | 63 Int8List(int length); |
| 64 Int8List.view(ByteArray array, [int start, int length]); | 64 Int8List.view(ByteArray array, [int start, int length]); |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 int removeLast() { | 277 int removeLast() { |
| 278 throw const UnsupportedOperationException( | 278 throw const UnsupportedOperationException( |
| 279 "Cannot remove from a non-extendable array"); | 279 "Cannot remove from a non-extendable array"); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void removeRange(int start, int length) { | 282 void removeRange(int start, int length) { |
| 283 throw const UnsupportedOperationException( | 283 throw const UnsupportedOperationException( |
| 284 "Cannot remove from a non-extendable array"); | 284 "Cannot remove from a non-extendable array"); |
| 285 } | 285 } |
| 286 | 286 |
| 287 ByteArray asByteArray([int offsetInBytes = 0, int lengthInBytes]) { | 287 ByteArray asByteArray([int start = 0, int length]) { |
| 288 if (lengthInBytes === null) { | 288 if (length === null) { |
| 289 lengthInBytes = this.lengthInBytes(); | 289 length = this.lengthInBytes(); |
| 290 } | 290 } |
| 291 return new _ByteArrayView(this, offsetInBytes, lengthInBytes); | 291 return new _ByteArrayView(this, start, length); |
| 292 } | 292 } |
| 293 | 293 |
| 294 int _length() native "ByteArray_getLength"; | 294 int _length() native "ByteArray_getLength"; |
| 295 | 295 |
| 296 void _setRange(int startInBytes, int lengthInBytes, | 296 void _setRange(int startInBytes, int lengthInBytes, |
| 297 _ByteArrayBase from, int startFromInBytes) | 297 _ByteArrayBase from, int startFromInBytes) |
| 298 native "ByteArray_setRange"; | 298 native "ByteArray_setRange"; |
| 299 | 299 |
| 300 int _getInt8(int byteOffset) native "ByteArray_getInt8"; | 300 int _getInt8(int byteOffset) native "ByteArray_getInt8"; |
| 301 void _setInt8(int byteOffset, int value) native "ByteArray_setInt8"; | 301 void _setInt8(int byteOffset, int value) native "ByteArray_setInt8"; |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 } | 2423 } |
| 2424 _rangeCheck(start, length); | 2424 _rangeCheck(start, length); |
| 2425 return _array.subByteArray(_offset + start, length); | 2425 return _array.subByteArray(_offset + start, length); |
| 2426 } | 2426 } |
| 2427 | 2427 |
| 2428 static final int _BYTES_PER_ELEMENT = 8; | 2428 static final int _BYTES_PER_ELEMENT = 8; |
| 2429 final ByteArray _array; | 2429 final ByteArray _array; |
| 2430 final int _offset; | 2430 final int _offset; |
| 2431 final int _length; | 2431 final int _length; |
| 2432 } | 2432 } |
| OLD | NEW |