Java IO Tutorial - Java BufferedWriter(Writer out) Constructor








Syntax

BufferedWriter(Writer out) constructor from BufferedWriter has the following syntax.

public BufferedWriter(Writer out)

Example

In the following code shows how to use BufferedWriter.BufferedWriter(Writer out) constructor.

/*from   w  w w .ja  va2  s. c  o m*/

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringWriter;

public class Main {
  public static void main(String[] args) throws IOException {

    String str = "from java2s.com!";

    StringWriter sw = new StringWriter();

    BufferedWriter bw = new BufferedWriter(sw);

  }
}