| OLD | NEW |
| 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 // This is a copy of "dart:io"'s BytesBuilder implementation, from | 5 // This is a copy of "dart:io"'s BytesBuilder implementation, from |
| 6 // sdk/lib/io/bytes_builder.dart. It's copied here to make it available to | 6 // sdk/lib/io/bytes_builder.dart. It's copied here to make it available to |
| 7 // non-"dart:io" applications (issue 18348). | 7 // non-"dart:io" applications (issue 18348). |
| 8 // | 8 // |
| 9 // Because it's copied directly, there are no modifications from the original. | 9 // Because it's copied directly, there are no modifications from the original. |
| 10 // | 10 // |
| 11 // This is up-to-date as of sdk revision | 11 // This is up-to-date as of sdk revision |
| 12 // 86227840d75d974feb238f8b3c59c038b99c05cf. | 12 // 86227840d75d974feb238f8b3c59c038b99c05cf. |
| 13 library http_parser.copy.bytes_builder; | |
| 14 | |
| 15 import 'dart:math'; | 13 import 'dart:math'; |
| 16 import 'dart:typed_data'; | 14 import 'dart:typed_data'; |
| 17 | 15 |
| 18 /** | 16 /** |
| 19 * Builds a list of bytes, allowing bytes and lists of bytes to be added at the | 17 * Builds a list of bytes, allowing bytes and lists of bytes to be added at the |
| 20 * end. | 18 * end. |
| 21 * | 19 * |
| 22 * Used to efficiently collect bytes and lists of bytes. | 20 * Used to efficiently collect bytes and lists of bytes. |
| 23 */ | 21 */ |
| 24 abstract class BytesBuilder { | 22 abstract class BytesBuilder { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 206 |
| 209 bool get isEmpty => _length == 0; | 207 bool get isEmpty => _length == 0; |
| 210 | 208 |
| 211 bool get isNotEmpty => _length != 0; | 209 bool get isNotEmpty => _length != 0; |
| 212 | 210 |
| 213 void clear() { | 211 void clear() { |
| 214 _length = 0; | 212 _length = 0; |
| 215 _chunks.clear(); | 213 _chunks.clear(); |
| 216 } | 214 } |
| 217 } | 215 } |
| OLD | NEW |