Method from java.io.CharArrayWriter Detail: |
public CharArrayWriter append(CharSequence csq) {
String s = (csq == null ? "null" : csq.toString());
write(s, 0, s.length());
return this;
}
Appends the specified character sequence to this writer.
An invocation of this method of the form out.append(csq)
behaves in exactly the same way as the invocation
out.write(csq.toString())
Depending on the specification of toString for the
character sequence csq, the entire sequence may not be
appended. For instance, invoking the toString method of a
character buffer will return a subsequence whose content depends upon
the buffer's position and limit. |
public CharArrayWriter append(char c) {
write(c);
return this;
}
Appends the specified character to this writer.
An invocation of this method of the form out.append(c)
behaves in exactly the same way as the invocation
out.write(c) |
public CharArrayWriter append(CharSequence csq,
int start,
int end) {
String s = (csq == null ? "null" : csq).subSequence(start, end).toString();
write(s, 0, s.length());
return this;
}
Appends a subsequence of the specified character sequence to this writer.
An invocation of this method of the form out.append(csq, start,
end) when csq is not null, behaves in
exactly the same way as the invocation
out.write(csq.subSequence(start, end).toString()) |
public void close() {
}
Close the stream. This method does not release the buffer, since its
contents might still be required. Note: Invoking this method in this class
will have no effect. |
public void flush() {
}
|
public void reset() {
count = 0;
}
Resets the buffer so that you can use it again without
throwing away the already allocated buffer. |
public int size() {
return count;
}
Returns the current size of the buffer. |
public char[] toCharArray() {
synchronized (lock) {
return Arrays.copyOf(buf, count);
}
}
Returns a copy of the input data. |
public String toString() {
synchronized (lock) {
return new String(buf, 0, count);
}
}
Converts input data to a string. |
public void write(int c) {
synchronized (lock) {
int newcount = count + 1;
if (newcount > buf.length) {
buf = Arrays.copyOf(buf, Math.max(buf.length < < 1, newcount));
}
buf[count] = (char)c;
count = newcount;
}
}
Writes a character to the buffer. |
public void write(char[] c,
int off,
int len) {
if ((off < 0) || (off > c.length) || (len < 0) ||
((off + len) > c.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
synchronized (lock) {
int newcount = count + len;
if (newcount > buf.length) {
buf = Arrays.copyOf(buf, Math.max(buf.length < < 1, newcount));
}
System.arraycopy(c, off, buf, count, len);
count = newcount;
}
}
Writes characters to the buffer. |
public void write(String str,
int off,
int len) {
synchronized (lock) {
int newcount = count + len;
if (newcount > buf.length) {
buf = Arrays.copyOf(buf, Math.max(buf.length < < 1, newcount));
}
str.getChars(off, off + len, buf, count);
count = newcount;
}
}
Write a portion of a string to the buffer. |
public void writeTo(Writer out) throws IOException {
synchronized (lock) {
out.write(buf, 0, count);
}
}
Writes the contents of the buffer to another character stream. |