Java IO Tutorial - Java FilterWriter.write(int c)








Syntax

FilterWriter.write(int c) has the following syntax.

public void write(int c)  throws IOException

Example

In the following code shows how to use FilterWriter.write(int c) method.

import java.io.FilterWriter;
import java.io.StringWriter;
import java.io.Writer;
/*  w w  w.  j  a v  a 2  s.c  o 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);
    fw.write(66);
    fw.write(67);

    String s = w.toString();

    System.out.print(s);

  }
}

The code above generates the following result.