FilterWriter.write(char[] cbuf, int off, int len) has the following syntax.
public void write(char[] cbuf, int off, int len) throws IOException
In the following code shows how to use FilterWriter.write(char[] cbuf, int off, int len) method.
// w w w.ja 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 { char[] cbuf = { 'A', 'B', 'C', 'D', 'E', 'F' }; Writer w = new StringWriter(6); FilterWriter fw = new FilterWriter(w) {}; fw.write(cbuf, 2, 4); String s = w.toString(); System.out.print(s); } }
The code above generates the following result.