| 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 part of dart.io; | 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 |
| 7 // non-"dart:io" applications (issue 18348). |
| 8 // |
| 9 // Because it's copied directly, there are no modifications from the original. |
| 10 library http_parser.bytes_builder; |
| 11 |
| 12 import 'dart:math'; |
| 13 import 'dart:typed_data'; |
| 6 | 14 |
| 7 /** | 15 /** |
| 8 * Builds a list of bytes, allowing bytes and lists of bytes to be added at the | 16 * Builds a list of bytes, allowing bytes and lists of bytes to be added at the |
| 9 * end. | 17 * end. |
| 10 * | 18 * |
| 11 * Used to efficiently collect bytes and lists of bytes. | 19 * Used to efficiently collect bytes and lists of bytes. |
| 12 */ | 20 */ |
| 13 abstract class BytesBuilder { | 21 abstract class BytesBuilder { |
| 14 /** | 22 /** |
| 15 * Construct a new empty [BytesBuilder]. | 23 * Construct a new empty [BytesBuilder]. |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 205 |
| 198 bool get isEmpty => _length == 0; | 206 bool get isEmpty => _length == 0; |
| 199 | 207 |
| 200 bool get isNotEmpty => _length != 0; | 208 bool get isNotEmpty => _length != 0; |
| 201 | 209 |
| 202 void clear() { | 210 void clear() { |
| 203 _length = 0; | 211 _length = 0; |
| 204 _chunks.clear(); | 212 _chunks.clear(); |
| 205 } | 213 } |
| 206 } | 214 } |
| OLD | NEW |