| 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. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 bool get isEmpty => length == 0; | 24 bool get isEmpty => length == 0; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Converts [obj] to a string and adds it to the buffer. | 27 * Converts [obj] to a string and adds it to the buffer. |
| 28 * | 28 * |
| 29 * *Deprecated*. Use [write] instead. | 29 * *Deprecated*. Use [write] instead. |
| 30 */ | 30 */ |
| 31 @deprecated | 31 @deprecated |
| 32 void add(Object obj) => write(obj); | 32 void add(Object obj) => write(obj); |
| 33 | 33 |
| 34 /// Adds the contents of [obj], converted to a string, to the buffer. |
| 34 external void write(Object obj); | 35 external void write(Object obj); |
| 35 | 36 |
| 37 /// Adds the string representation of [charCode] to the buffer. |
| 38 external void writeCharCode(int charCode); |
| 39 |
| 36 void writeAll(Iterable objects) { | 40 void writeAll(Iterable objects) { |
| 37 for (Object obj in objects) write(obj); | 41 for (Object obj in objects) write(obj); |
| 38 } | 42 } |
| 39 | 43 |
| 40 void writeln(Object obj) { | 44 void writeln(Object obj) { |
| 41 write(obj); | 45 write(obj); |
| 42 write("\n"); | 46 write("\n"); |
| 43 } | 47 } |
| 44 | 48 |
| 45 /** | 49 /** |
| 46 * Adds the string representation of [charCode] to the buffer. | 50 * Adds the string representation of [charCode] to the buffer. |
| 47 * | 51 * |
| 48 * *Deprecated* Use [writeCharCode] instead. | 52 * *Deprecated* Use [writeCharCode] instead. |
| 49 */ | 53 */ |
| 50 @deprecated | 54 @deprecated |
| 51 void addCharCode(int charCode) { | 55 void addCharCode(int charCode) { |
| 52 writeCharCode(charCode); | 56 writeCharCode(charCode); |
| 53 } | 57 } |
| 54 | 58 |
| 55 /// Adds the string representation of [charCode] to the buffer. | |
| 56 void writeCharCode(int charCode) { | |
| 57 write(new String.fromCharCode(charCode)); | |
| 58 } | |
| 59 | |
| 60 /** | 59 /** |
| 61 * Adds all items in [objects] to the buffer. | 60 * Adds all items in [objects] to the buffer. |
| 62 * | 61 * |
| 63 * *Deprecated*. Use [writeAll] instead. | 62 * *Deprecated*. Use [writeAll] instead. |
| 64 */ | 63 */ |
| 65 @deprecated | 64 @deprecated |
| 66 void addAll(Iterable objects) { | 65 void addAll(Iterable objects) { |
| 67 for (Object obj in objects) write(obj); | 66 for (Object obj in objects) write(obj); |
| 68 } | 67 } |
| 69 | 68 |
| 70 /** | 69 /** |
| 71 * Clears the string buffer. | 70 * Clears the string buffer. |
| 72 * | 71 * |
| 73 * *Deprecated*. | 72 * *Deprecated*. |
| 74 */ | 73 */ |
| 75 @deprecated | 74 @deprecated |
| 76 external void clear(); | 75 external void clear(); |
| 77 | 76 |
| 78 /// Returns the contents of buffer as a concatenated string. | 77 /// Returns the contents of buffer as a concatenated string. |
| 79 external String toString(); | 78 external String toString(); |
| 80 } | 79 } |
| OLD | NEW |