Java CharArrayWriter.flush()
Syntax
CharArrayWriter.flush() has the following syntax.
public void flush()
Example
In the following code shows how to use CharArrayWriter.flush() method.
/* ww w .j av a 2s. c o m*/
import java.io.CharArrayWriter;
public class Main {
public static void main(String[] args) {
CharArrayWriter chw = new CharArrayWriter();
CharSequence csq = "java2s.com";
// append character sequence to the writer
chw.append(csq);
// flush
chw.flush();
// prints out the character sequences
System.out.println(chw.toString());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »