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