| 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Utility class that can fast concatenate [List<int>]s of bytes. Use | 8 * Utility class that can fast concatenate [List<int>]s of bytes. Use |
| 9 * [readBytes] to get the final buffer. | 9 * [readBytes] to get the final buffer. |
| 10 */ | 10 */ |
| 11 class _BufferList { | 11 class _BufferList { |
| 12 const int _INIT_SIZE = 1 * 1024; | 12 static const int _INIT_SIZE = 1 * 1024; |
| 13 | 13 |
| 14 _BufferList() { | 14 _BufferList() { |
| 15 clear(); | 15 clear(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 int pow2roundup(int x) { | 18 int pow2roundup(int x) { |
| 19 --x; | 19 --x; |
| 20 x |= x >> 1; | 20 x |= x >> 1; |
| 21 x |= x >> 2; | 21 x |= x >> 2; |
| 22 x |= x >> 4; | 22 x |= x >> 4; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 * Clears the content of the buffer list. | 91 * Clears the content of the buffer list. |
| 92 */ | 92 */ |
| 93 void clear() { | 93 void clear() { |
| 94 _length = 0; | 94 _length = 0; |
| 95 _buffer = null; | 95 _buffer = null; |
| 96 } | 96 } |
| 97 | 97 |
| 98 int _length; // Total number of bytes in the buffer. | 98 int _length; // Total number of bytes in the buffer. |
| 99 Uint8List _buffer; // Internal buffer. | 99 Uint8List _buffer; // Internal buffer. |
| 100 } | 100 } |
| OLD | NEW |