Java CharArrayWriter Class

The CharArrayWriter class can be used to write common data to multiple files. This class inherits Writer class. Its buffer automatically grows when data is written in this stream. Calling the close() method on this object has no effect.

Java CharArrayWriter class declaration

public class CharArrayWriter extends Writer

Java CharArrayReader class methods

  1. int size()

    It is used to return the current size of the buffer.

  2. char[] toCharArray()

    It is used to return the copy of an input data.

  3. String toString()

    It is used for converting an input data to a string.

  4. CharArrayWriter append(char c)

    It is used to append the specified character to the writer.

  5. CharArrayWriter append(CharSequence csq)

    It is used to append the specified character sequence to the writer.

  6. CharArrayWriter append(CharSequence csq, int start, int end)

    It is used to append the subsequence of a specified character to the writer.

  7. void write(int c)

    It is used to write a character to the buffer.

  8. void flush()

    It is used to flush the stream.


Example of CharArrayWriter Class:

Flash Soon


Output:



Advertisement

Copyright ©2017 Design& develop