Java CharArrayWriter.write(char[] c, int off, int len)
Syntax
CharArrayWriter.write(char[] c, int off, int len) has the following syntax.
public void write(char[] c, int off, int len)
Example
In the following code shows how to use CharArrayWriter.write(char[] c, int off, int len) method.
//from w w w . j a v a 2 s . co m
import java.io.CharArrayWriter;
public class Main {
public static void main(String[] args) {
char[] ch = { 'A', 'B', 'C', 'D', 'E' };
CharArrayWriter chw = new CharArrayWriter();
// write character buffer to the writer
chw.write(ch, 3, 2);
String str = chw.toString();
System.out.print(str);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »