package com.letv.test.base;

import java.util.Arrays;

public class StringBuffer {
private char[] value;
private int count;

public StringBuffer() {
value = new char[16];
count = 0;
}

public StringBuffer(String str) {
value = Arrays.copyOf(str.toCharArray(), str.length() + 16);
count = str.length();
}

public synchronized StringBuffer appen(String str) {
if (count + str.length() > value.length) {
value = Arrays.copyOf(value, count + str.length() + 16);
}
System.arraycopy(str.toCharArray(), 0, value, count, str.length());
// str.getChars(0, str.length(), value, count);
count = count + str.length();
return this;
}
}
posted on 2018-09-05 19:07  塞北夜莺  阅读(545)  评论(0编辑  收藏  举报