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 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * Builds a list of bytes, allowing bytes and lists of bytes to be added at the | 8 * Builds a list of bytes, allowing bytes and lists of bytes to be added at the |
9 * end. | 9 * end. |
10 * | 10 * |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 * The number of bytes in the builder. | 91 * The number of bytes in the builder. |
92 */ | 92 */ |
93 int get length => _length; | 93 int get length => _length; |
94 | 94 |
95 /** | 95 /** |
96 * Returns `true` if the buffer is empty. | 96 * Returns `true` if the buffer is empty. |
97 */ | 97 */ |
98 bool get isEmpty => _length == 0; | 98 bool get isEmpty => _length == 0; |
99 | 99 |
100 /** | 100 /** |
101 * Returns `true` if the buffer is empty. | 101 * Returns `true` if the buffer is not empty. |
102 */ | 102 */ |
103 bool get isNotEmpty => _length != 0; | 103 bool get isNotEmpty => _length != 0; |
104 | 104 |
105 /** | 105 /** |
106 * Clear the contents of the builder. | 106 * Clear the contents of the builder. |
107 */ | 107 */ |
108 void clear() { | 108 void clear() { |
109 _length = 0; | 109 _length = 0; |
110 _buffer = null; | 110 _buffer = null; |
111 } | 111 } |
112 | 112 |
113 int _pow2roundup(int x) { | 113 int _pow2roundup(int x) { |
114 --x; | 114 --x; |
115 x |= x >> 1; | 115 x |= x >> 1; |
116 x |= x >> 2; | 116 x |= x >> 2; |
117 x |= x >> 4; | 117 x |= x >> 4; |
118 x |= x >> 8; | 118 x |= x >> 8; |
119 x |= x >> 16; | 119 x |= x >> 16; |
120 return x + 1; | 120 return x + 1; |
121 } | 121 } |
122 } | 122 } |
OLD | NEW |