| Index: editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| diff --git a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| index a450fbd85de638cc6afdb9fe190f37f7403ca222..72bdc99c952196a2ab12d939c9c96fae1b7f711b 100644
|
| --- a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| +++ b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| @@ -217,6 +217,12 @@ class IllegalArgumentException implements Exception {
|
| String toString() => "IllegalStateException: $message";
|
| }
|
|
|
| +class StringIndexOutOfBoundsException implements Exception {
|
| + final int index;
|
| + const StringIndexOutOfBoundsException(this.index);
|
| + String toString() => "StringIndexOutOfBoundsException: $index";
|
| +}
|
| +
|
| class IllegalStateException implements Exception {
|
| final String message;
|
| const IllegalStateException([this.message = ""]);
|
| @@ -390,3 +396,31 @@ void javaMapPutAll(Map target, Map source) {
|
| bool javaStringEqualsIgnoreCase(String a, String b) {
|
| return a.toLowerCase() == b.toLowerCase();
|
| }
|
| +
|
| +class JavaStringBuilder {
|
| + StringBuffer sb = new StringBuffer();
|
| + String toString() => sb.toString();
|
| + void append(x) {
|
| + sb.write(x);
|
| + }
|
| + void appendChar(int c) {
|
| + sb.writeCharCode(c);
|
| + }
|
| + int get length => sb.length;
|
| + void set length(int newLength) {
|
| + if (newLength < 0) {
|
| + throw new StringIndexOutOfBoundsException(newLength);
|
| + }
|
| + if (sb.length < newLength) {
|
| + while (sb.length < newLength) {
|
| + sb.writeCharCode(0);
|
| + }
|
| + } else if (sb.length > newLength) {
|
| + var s = sb.toString().substring(0, newLength);
|
| + sb = new StringBuffer(s);
|
| + }
|
| + }
|
| + void clear() {
|
| + sb = new StringBuffer();
|
| + }
|
| +}
|
|
|