| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The StringBuffer class is useful for concatenating strings | 8 * The StringBuffer class is useful for concatenating strings |
| 9 * efficiently. Only on a call to [toString] are the strings | 9 * efficiently. Only on a call to [toString] are the strings |
| 10 * concatenated to a single String. | 10 * concatenated to a single String. |
| 11 */ | 11 */ |
| 12 class StringBuffer implements StringSink { | 12 class StringBuffer implements StringSink { |
| 13 | 13 |
| 14 /// Creates the string buffer with an initial content. | 14 /** Creates the string buffer with an initial content. */ |
| 15 external StringBuffer([Object content = ""]); | 15 external StringBuffer([Object content = ""]); |
| 16 | 16 |
| 17 /// Returns the length of the buffer. | 17 /** |
| 18 * Returns the length of the content that has been accumulated so far. |
| 19 * This is a constant-time operation. |
| 20 */ |
| 18 external int get length; | 21 external int get length; |
| 19 | 22 |
| 20 /// Returns whether the buffer is empty. | 23 /** Returns whether the buffer is empty. This is a constant-time operation. */ |
| 21 bool get isEmpty => length == 0; | 24 bool get isEmpty => length == 0; |
| 22 | 25 |
| 23 /** | 26 /** |
| 24 * Converts [obj] to a string and adds it to the buffer. | 27 * Converts [obj] to a string and adds it to the buffer. |
| 25 * | 28 * |
| 26 * *Deprecated*. Use [write] instead. | 29 * *Deprecated*. Use [write] instead. |
| 27 */ | 30 */ |
| 28 @deprecated | 31 @deprecated |
| 29 void add(Object obj) => write(obj); | 32 void add(Object obj) => write(obj); |
| 30 | 33 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 * Clears the string buffer. | 71 * Clears the string buffer. |
| 69 * | 72 * |
| 70 * *Deprecated*. | 73 * *Deprecated*. |
| 71 */ | 74 */ |
| 72 @deprecated | 75 @deprecated |
| 73 external void clear(); | 76 external void clear(); |
| 74 | 77 |
| 75 /// Returns the contents of buffer as a concatenated string. | 78 /// Returns the contents of buffer as a concatenated string. |
| 76 external String toString(); | 79 external String toString(); |
| 77 } | 80 } |
| OLD | NEW |