Note
Invoking close() on this class has no effect, and methods of this class can be called after the stream has closed without generating an IOException.
| Modifier and Type | Field and Description |
|---|---|
| protected char[] | buf
The buffer where data is stored. |
| protected int | count
The number of chars in the buffer. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CharArrayWriter(int
an int specifying the initial buffer size. initialSize)Creates a new CharArrayWriter with the specified initial size. |
| Modifier and Type | Method and Description |
|---|---|
| public CharArrayWriter | Returns: This writerThe character sequence to append. If csq)csq is
null, then the four characters "null" are
appended to this writer.Overrides java. Implements java. Appends the specified character sequence to this writer. |
| public CharArrayWriter | Returns: This writerThe character sequence from which a subsequence will be
appended. If csq, int csq is null, then characters
will be appended as if csq contained the four
characters "null".The index of the first character in the subsequence start, int The index of the character following the last character in the
subsequence end)Overrides java. Implements java. Appends a subsequence of the specified character sequence to this writer. |
| public CharArrayWriter | Returns: This writerThe 16-bit character to append c)Overrides java. Implements java. Appends the specified character to this writer. |
| public void | close()
Implements abstract java. Implements java. Close the stream. |
| public void | flush()
Implements abstract java. Implements java. Flush the stream. |
| public void | reset()
Resets the buffer so that you can use it again without throwing away the already allocated buffer. |
| public int | Returns: an int representing the current size of the buffer.Returns the current size of the buffer. |
| public char[] | Returns: an array of chars copied from the input data.Returns a copy of the input data. |
| public String | |
| public void | |
| public void | write(char[]
the data to be written c, int the start offset in the data off, int the number of chars that are written len)Implements abstract java. Writes characters to the buffer. |
| public void | write(String
String to be written from str, int Offset from which to start reading characters off, int Number of characters to be written len)Overrides java. Write a portion of a string to the buffer. |
| public void |
| buf | back to summary |
|---|---|
| protected char[] buf The buffer where data is stored. | |
| count | back to summary |
|---|---|
| protected int count The number of chars in the buffer. | |
| CharArrayWriter | back to summary |
|---|---|
| public CharArrayWriter() Creates a new CharArrayWriter. | |
| CharArrayWriter | back to summary |
|---|---|
| public CharArrayWriter(int initialSize) Creates a new CharArrayWriter with the specified initial size.
| |
| append | back to summary |
|---|---|
| public CharArrayWriter append(CharSequence csq) Overrides java. Implements java. Appends the specified character sequence to this writer. An invocation of this method of the form out.write(csq.toString()) Depending on the specification of
| |
| append | back to summary |
|---|---|
| public CharArrayWriter append(CharSequence csq, int start, int end) Overrides java. Implements java. Appends a subsequence of the specified character sequence to this writer. An invocation of this method of the form
out.write(csq.subSequence(start, end).toString())
| |
| append | back to summary |
|---|---|
| public CharArrayWriter append(char c) Overrides java. Implements java. Appends the specified character to this writer. An invocation of this method of the form out.write(c)
| |
| close | back to summary |
|---|---|
| public void close() Implements abstract java. Implements java. 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. | |
| flush | back to summary |
|---|---|
| public void flush() Implements abstract java. Implements java. Flush the stream. The | |
| reset | back to summary |
|---|---|
| public void reset() Resets the buffer so that you can use it again without throwing away the already allocated buffer. | |
| size | back to summary |
|---|---|
| public int size() Returns the current size of the buffer.
| |
| toCharArray | back to summary |
|---|---|
| public char[] toCharArray() Returns a copy of the input data.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Converts input data to a string.
| |
| write | back to summary |
|---|---|
| public void write(int c) Overrides java. Writes a character to the buffer. | |
| write | back to summary |
|---|---|
| public void write(char[] c, int off, int len) Implements abstract java. Writes characters to the buffer.
| |
| write | back to summary |
|---|---|
| public void write(String str, int off, int len) Overrides java. Write a portion of a string to the buffer.
| |
| writeTo | back to summary |
|---|---|
| public void writeTo(Writer out) throws IOException Writes the contents of the buffer to another character stream.
| |