Java FilterWriter.flush()
Syntax
FilterWriter.flush() has the following syntax.
public void flush() throws IOException
Example
In the following code shows how to use FilterWriter.flush() method.
//from www. j a v a 2s.c o m
import java.io.FilterWriter;
import java.io.StringWriter;
import java.io.Writer;
public class Main {
public static void main(String[] args) throws Exception {
Writer w = new StringWriter(6);
FilterWriter fw = new FilterWriter(w) {};
fw.write(65);
fw.flush();
String s = w.toString();
System.out.print(s);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »